Defines the grammar for writing Boolean formulas.
View Source
class PropositionParser: """Parser to create trees from Boolean expressions provided as strings.""" def __init__(self): self.lexer = _Lexer.build() self.parser = _Parser.build() def parse(self, expression: str): """Parses an expression. Args: expression: The expression to parse. """ return self.parser.parse(expression) @classmethod def operations(cls) -> list: """Returns list of all operations supported by the parser.""" return _Parser().operations
Parser to create trees from Boolean expressions provided as strings.
View Source
def __init__(self): self.lexer = _Lexer.build() self.parser = _Parser.build()
View Source
def parse(self, expression: str): """Parses an expression. Args: expression: The expression to parse. """ return self.parser.parse(expression)
Parses an expression.
Args: expression: The expression to parse.
View Source
@classmethod def operations(cls) -> list: """Returns list of all operations supported by the parser.""" return _Parser().operations
Returns list of all operations supported by the parser.