# # Context free grammar of tokens (terminal # nodes) for the Emerald language. # grammar Scopes include Variables rule scope_fn (given / unless / each / with) "\n" end rule given "given" space* boolean_expr end rule unless "unless" space* boolean_expr end rule with "with" space* variable_name end rule each "each" space* collection:variable_name space* "as" space* val_name:variable_name indexed:(',' space* key_name:variable_name)? end rule boolean_expr binary_expr / unary_expr end rule binary_expr lhs:unary_expr space+ op:("and" / "or") space* rhs:boolean_expr end rule unary_expr negated:("not" space+)? (val:variable_name / '(' space* val:boolean_expr space* ')') end end