glr2.cc: example: simplify

* examples/c++/glr/c++-types.yy: Formatting changes.
Remove unused support for '@'.
* examples/c/glr/c++-types.y: Ditto.
This commit is contained in:
Akim Demaille
2020-12-26 17:38:47 +01:00
parent bb97a2a37b
commit 89296e3962
2 changed files with 5 additions and 8 deletions

View File

@@ -71,12 +71,10 @@ prog : %empty
stmt : expr ';' %merge <stmtMerge> { $$ = $1; }
| decl %merge <stmtMerge>
| error ';' { $$ = Nterm ("<error>"); }
| '@' { $$ = $1; YYACCEPT; }
;
expr : ID
| TYPENAME '(' expr ')'
{ $$ = Nterm ("<cast>", $3, $1); }
| TYPENAME '(' expr ')' { $$ = Nterm ("<cast>", $3, $1); }
| expr '+' expr { $$ = Nterm ("+", $1, $3); }
| expr '=' expr { $$ = Nterm ("=", $1, $3); }
;

View File

@@ -84,7 +84,6 @@ prog : %empty
stmt : expr ';' %merge <stmtMerge> { $$ = $1; }
| decl %merge <stmtMerge>
| error ';' { $$ = new_nterm ("<error>", NULL, NULL, NULL); }
| '@' { $$ = $1; YYACCEPT; }
;
expr : ID