examples/deterministic.ace in antelope-0.1.8 vs examples/deterministic.ace in antelope-0.1.9
- old
+ new
@@ -1,21 +1,33 @@
%require "~> 0.1"
-%type "ruby"
+%generator "ruby"
-%terminal NUMBER
-%terminal SEMICOLON ";"
-%terminal ADD "+"
-%terminal LPAREN "("
-%terminal RPAREN ")"
+%define api.push-pull pull
+%define panic-mode true
+%token <lex> NUMBER
+%token <lex> SEMICOLON ";"
+%token <lex> ADD "+"
+%token <lex> LPAREN "("
+%token <lex> RPAREN ")"
+%type <node> s e t
+
+%null.data api.prefix "antelope_"
+%union {
+ struct slip_parser_node* node;
+ struct slip_lex_token* lex;
+ struct slip_parser_list* list;
+}
+
%%
s: e
-e: t SEMICOLON
- | t ADD e
+e: t[a] SEMICOLON[b] { $$ = $1 }
+ | t[a] ADD[b] e[c] { $$ = $1 + $2 }
+ | error[a]
t: NUMBER
- | LPAREN e RPAREN
+ | LPAREN e RPAREN { $$ = $2 }
%%
class DeterministicParser < Antelope::Parser
%{write}