summaryrefslogtreecommitdiffstats
path: root/taccle/examples/if_then_else.tac
diff options
context:
space:
mode:
Diffstat (limited to 'taccle/examples/if_then_else.tac')
-rw-r--r--taccle/examples/if_then_else.tac18
1 files changed, 18 insertions, 0 deletions
diff --git a/taccle/examples/if_then_else.tac b/taccle/examples/if_then_else.tac
new file mode 100644
index 0000000..eee631a
--- /dev/null
+++ b/taccle/examples/if_then_else.tac
@@ -0,0 +1,18 @@
+# $Id: if_then_else.tac,v 1.1 2004/08/18 23:53:42 tang Exp $
+
+# The classical if/then/else ambiguity. taccle resolves this by
+# giving higher precedence to shifting else.
+#
+# References:
+# Dragon book, page 250
+# lex & yacc, pages 233-235
+
+%token IF ELSE TERMINAL
+
+%%
+
+stmt: IF '(' cond ')' stmt
+ | IF '(' cond ')' stmt ELSE stmt
+ | TERMINAL;
+
+cond: TERMINAL;