bsat.logic.grammar

Defines the grammar for writing Boolean formulas.

#   class PropositionParser:
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.

#   PropositionParser()
View Source
    def __init__(self):
        self.lexer = _Lexer.build()
        self.parser = _Parser.build()
#   def parse(self, expression: str):
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.

#  
@classmethod
def operations(cls) -> list:
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.