Skip to content
Olivier Duhart edited this page Nov 10, 2018 · 5 revisions

lexer

IDENTIFIER : an id is a sequence of letters
COLON : ":"
ZEROORMORE : "*"
ONEORMORE : "+"
OPTION : "?"
DISCARD : "[d]"
LPAREN :"("
RPAREN : ")";

parser

rule : IDENTIFIER COLON clauses

clauses : clause clauses
clauses : clause 

# clause

clause : IDENTIFIER ZEROORMORE
clause : IDENTIFIER ONEORMORE
clause : IDENTIFIER OPTION
clause : IDENTIFIER DISCARD
clause : IDENTIFIER

# group

clause : LPAREN  groupclauses RPAREN
clause : LPAREN  groupclauses RPAREN ONEORMORE
clause : LPAREN  groupclauses RPAREN ZEROORMORE
clause : LPAREN  groupclauses RPAREN OPTION

groupclauses : groupclause groupclauses
groupclauses : groupclause
groupclause : IDENTIFIER
groupclause : IDENTIFIER DISCARD