Class: LEMParser

LEMParser

LEMParser is a recursive descent parser that consumes a stream of tokens (provided by a LEMTokenizer) and produces an abstract syntax tree according to the following syntactic grammar, shown in Extended Backus-Naur Form. The grammar is equivalent to an LL(1) grammar, but is not quite LL(1) in the form shown below

In the following definition, [] denotes an option and {} denotes repetition. Words in all caps denote terminal tokens as defined in TokenType

expression = 
    expressionContents, {[binaryBooleanOperator], expressionContents}

expressionContents = 
    L_PAREN, expression, R_PAREN
    | implicitSearch
    | identifier, (EQ | NE), literalOrRef

literalOrRef =
    DOLLAR, identifier
    | literal

literal =
    stringLiteral | REGEX_LITERAL

identifier =
    CHAR_SEQ

stringLiteral = 
    CHAR_SEQ | STRING_LITERAL

implicitSearch = 
    stringLiteral
    
binaryBooleanOperator = 
    PIPE | AMP | CARET