/*
$ eyapp -C dummytoken.eyp
$ ./dummytoken.pm -t -i --dot t.png -m 1 -c 'if e then if e then o else o'
IFTHEN(
TERMINAL[e],
IFTHENELSE(
TERMINAL[e],
TERMINAL[o],
TERMINAL[o]
)
)
Also have a look at the t.png output file
The following execution gives an error:
$ ./dummytoken.pm -c 'TUTU'
*/
%syntactic token IF = /(?i:if)/
%syntactic token ELSE = /(?i:else)/
%syntactic token THEN = /(?i:then)/
%token EXPR = /(?i:(e))/
%token OTHERSTMT = /(?i:(o))/
# A dummy token is never generated by the lexical analyzer
%dummy token TUTU
%left TUTU
%left ELSE
%tree bypass
%%
stmt:
%name IFTHEN
IF expr THEN stmt %prec TUTU
| %name IFTHENELSE
IF expr THEN stmt ELSE stmt
| OTHERSTMT
| TUTU # will be rejected. The input 'TUTU' produces an error, since the token isn't generated
;
expr:
EXPR
;
%%