TLAParser

Struct TLAParser 

Source
pub struct TLAParser {}
Expand description

Parser for supported subset of TLA+

This parser is designed to parse TLA+ specifications that fall into the translatable fragment

Implementations§

Source§

impl TLAParser

Source

pub fn new() -> Self

Create a new parser for TLA specifications

Source

fn parse_specification_and_add_expressions<'a>( &self, pair: Vec<Pair<'a, Rule>>, builder: ELTLSpecificationBuilder<'a, GeneralThresholdAutomaton>, ctx: TLAParsingContext<'_>, ) -> Result<ELTLSpecificationBuilder<'a, GeneralThresholdAutomaton>, Error>

Parse specification list into ltl expressions

Source

fn parse_ta_and_return_ltl_pairs<'a>( &self, input: &'a str, ) -> Result<(GeneralThresholdAutomaton, Vec<Pair<'a, Rule>>, TLAParsingContext<'a>), Error>

Source

fn validate_module_imports<'a>( pairs: &mut Pairs<'a, Rule>, pair: Pair<'a, Rule>, ) -> Pair<'a, Rule>

Validate the imports appearing in the TLA file

This function will not fail, it will only produce warnings on TLC compatibility

Source

fn parse_constant_declaration<'a>( pairs: &mut Pairs<'a, Rule>, pair: Pair<'a, Rule>, builder: GeneralThresholdAutomatonBuilder, ) -> Result<(Pair<'a, Rule>, GeneralThresholdAutomatonBuilder), Error>

Parses all constant declarations

This block will parse all consecutive constant_declarations pairs. Every such block is CONSTANT declaration and declares the parameters of a threshold automaton. Additionally, the constants NbOfCorrProcesses and Processes should be declared.

Source

fn parse_assume_declaration<'a>( pair: Pair<'a, Rule>, builder: InitializedGeneralThresholdAutomatonBuilder, ctx: &mut TLAParsingContext<'_>, ) -> Result<InitializedGeneralThresholdAutomatonBuilder, Error>

Parse and validate an ASSUME block, i.e. a resilience condition

This function parses one ASSUME definition, but there can be potentially multiple ones

Source

fn parse_variable_declaration<'a>( pairs: &mut Pairs<'a, Rule>, pair: Pair<'a, Rule>, builder: GeneralThresholdAutomatonBuilder, ) -> Result<(Pair<'a, Rule>, GeneralThresholdAutomatonBuilder), Error>

Parse a variable declaration, i.e. the VARIABLE / VARIABLES declaration of of a TLA file

This declaration needs to declare all shared variables of the resulting TA, as well as the variable ‘ProcessesLocations’ which is the function from process identifiers to their current location.

Source

fn parse_type_ok<'a>( pairs: &mut Pairs<'a, Rule>, pair: Pair<'a, Rule>, builder: GeneralThresholdAutomatonBuilder, ) -> Result<(Pair<'a, Rule>, InitializedGeneralThresholdAutomatonBuilder), Error>

Parse the TypeOk block into the set of locations and validates that it declares a type for all shared variables, that should be declared as type ‘Nat’.

Source

fn parse_initial_constraint_declaration<'a>( pairs: &mut Pairs<'a, Rule>, pair: Pair<'a, Rule>, builder: InitializedGeneralThresholdAutomatonBuilder, ctx: &mut TLAParsingContext<'_>, ) -> Result<(Option<Pair<'a, Rule>>, InitializedGeneralThresholdAutomatonBuilder), Error>

Parse the initial constraints of an Init block

Source

fn parse_int_macro_declarations<'a>( pairs: &mut Pairs<'a, Rule>, pair: Option<Pair<'a, Rule>>, ctx: &mut TLAParsingContext<'a>, ) -> Option<Pair<'a, Rule>>

Parse all consecutive declaration of integer macros

Source

fn parse_rule_declarations<'a>( pairs: &mut Pairs<'a, Rule>, pair: Pair<'a, Rule>, builder: InitializedGeneralThresholdAutomatonBuilder, ctx: &mut TLAParsingContext<'a>, ) -> Result<(Option<Pair<'a, Rule>>, InitializedGeneralThresholdAutomatonBuilder), Error>

Parse all consecutive declarations of rules

Source

fn parse_next_declaration<'a>( pairs: &mut Pairs<'a, Rule>, pair: Option<Pair<'a, Rule>>, ctx: &mut TLAParsingContext<'_>, ) -> Result<Option<Pair<'a, Rule>>, Error>

Parse a Next declaration and extract all appearing rules

Source

fn validate_spec_declaration<'a>( pairs: &mut Pairs<'a, Rule>, pair: Option<Pair<'a, Rule>>, ctx: &mut TLAParsingContext<'_>, builder: &InitializedGeneralThresholdAutomatonBuilder, ) -> Result<Option<Pair<'a, Rule>>, Error>

Parse a Spec declaration and validate that it is consistent

Trait Implementations§

Source§

impl Default for TLAParser

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl ParseTA for TLAParser

Source§

fn parse_ta(&self, input: &str) -> Result<GeneralThresholdAutomaton, Error>

Try to parse the threshold automaton from a string.
Source§

impl ParseTAWithLTL for TLAParser

Source§

fn parse_ta_and_spec( &self, input: &str, ) -> Result<(GeneralThresholdAutomaton, ELTLSpecification), Error>

Try to parse the threshold automaton and LTL specification from a string. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.