summaryrefslogtreecommitdiffstats
path: root/taccle/examples/shift_reduce.tac
diff options
context:
space:
mode:
Diffstat (limited to 'taccle/examples/shift_reduce.tac')
-rw-r--r--taccle/examples/shift_reduce.tac17
1 files changed, 17 insertions, 0 deletions
diff --git a/taccle/examples/shift_reduce.tac b/taccle/examples/shift_reduce.tac
new file mode 100644
index 0000000..8905e26
--- /dev/null
+++ b/taccle/examples/shift_reduce.tac
@@ -0,0 +1,17 @@
+# $Id: shift_reduce.tac,v 1.1 2004/08/18 23:53:43 tang Exp $
+
+# This is an example of a shift/reduce conflict. Eventually I will
+# add operator precedence and associativity, but for now taccle simply
+# gives higher precedence to shifts.
+#
+# Reference:
+# lex & yacc, pages 229-230 and 236
+
+%token TERMINAL
+
+%%
+
+expr: TERMINAL
+ | expr '+' expr
+ | expr '-' expr
+ | expr '*' expr ;