Package listnew3; Helpers tab = 9; cr = 13; lf = 10; eol = [[cr + lf] + [cr + lf]]; white = [[' ' + tab] + eol]; lowercase = ['a' .. 'z']; uppercase = ['A' .. 'Z']; letter = [uppercase + lowercase]; digit = ['0'..'9']; id_part = lowercase (lowercase | digit)*; blank = (' ' | tab | eol)+; Tokens minus = '-'; semicolon = ';'; letter = letter; tar = 'tar'; to = 'to'; id = id_part ('_' id_part)*; l_bkt = '['; r_bkt = ']'; digit = digit; comma = ','; blank = blank; comment = '//' letter*; Ignored Tokens/* These tokens are simply ignored by the parser. */ blank, comment; /*****************/ Productions grammar = P.tar {-> New grammar([P.tar.tar])}; tar {-> P.tar*} = [l]:another anothertail [r]:another {-> [New tar.second(Null, Null) New tar.second(anothertail.tar, anothertail.minus) New tar.second(Null, Null)]}; another {-> T.tar minus} = T.tar minus [first]:id letter id {-> T.tar minus }; anothertail {-> T.tar minus} = comma another {-> another.tar another.minus}; Abstract Syntax Tree grammar = P.tar*; tar = {vide} | {first} T.tar* | {second} T.tar minus | {third} T.tar* minus* id*;