summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorAkim Demaille <akim.demaille@gmail.com>2020-12-26 17:38:47 +0100
committerAkim Demaille <akim.demaille@gmail.com>2020-12-26 17:40:18 +0100
commit89296e39625eb8675ff9067f958d79fdd5dbccb5 (patch)
tree73ce54109625e7eccf46eef054e3a3c1e8d44fa3 /examples
parentbb97a2a37b891998642781054fa0a4b91641342f (diff)
downloadbison-89296e39625eb8675ff9067f958d79fdd5dbccb5.tar.gz
glr2.cc: example: simplify
* examples/c++/glr/c++-types.yy: Formatting changes. Remove unused support for '@'. * examples/c/glr/c++-types.y: Ditto.
Diffstat (limited to 'examples')
-rw-r--r--examples/c++/glr/c++-types.yy12
-rw-r--r--examples/c/glr/c++-types.y1
2 files changed, 5 insertions, 8 deletions
diff --git a/examples/c++/glr/c++-types.yy b/examples/c++/glr/c++-types.yy
index ce6ae4f1..20020723 100644
--- a/examples/c++/glr/c++-types.yy
+++ b/examples/c++/glr/c++-types.yy
@@ -68,17 +68,15 @@ prog : %empty
| prog stmt { std::cout << @2 << ": " << $2 << '\n'; }
;
-stmt : expr ';' %merge <stmtMerge> { $$ = $1; }
+stmt : expr ';' %merge <stmtMerge> { $$ = $1; }
| decl %merge <stmtMerge>
- | error ';' { $$ = Nterm ("<error>"); }
- | '@' { $$ = $1; YYACCEPT; }
+ | error ';' { $$ = Nterm ("<error>"); }
;
expr : ID
- | TYPENAME '(' expr ')'
- { $$ = Nterm ("<cast>", $3, $1); }
- | expr '+' expr { $$ = Nterm ("+", $1, $3); }
- | expr '=' expr { $$ = Nterm ("=", $1, $3); }
+ | TYPENAME '(' expr ')' { $$ = Nterm ("<cast>", $3, $1); }
+ | expr '+' expr { $$ = Nterm ("+", $1, $3); }
+ | expr '=' expr { $$ = Nterm ("=", $1, $3); }
;
decl : TYPENAME declarator ';'
diff --git a/examples/c/glr/c++-types.y b/examples/c/glr/c++-types.y
index 33d1abc6..33bf58a6 100644
--- a/examples/c/glr/c++-types.y
+++ b/examples/c/glr/c++-types.y
@@ -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