summaryrefslogtreecommitdiff
path: root/test/treecmp1.lm
diff options
context:
space:
mode:
Diffstat (limited to 'test/treecmp1.lm')
-rw-r--r--test/treecmp1.lm25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/treecmp1.lm b/test/treecmp1.lm
new file mode 100644
index 0000000..3bd5b23
--- /dev/null
+++ b/test/treecmp1.lm
@@ -0,0 +1,25 @@
+##### LM #####
+rl ident_pattern /[a-zA-Z_][a-zA-Z_0-9]*/
+rl number_pattern /[0-9]+/
+
+lex
+ ignore /[ \t\n]+/
+ token id /ident_pattern/
+ token number /number_pattern/
+end
+
+def four_ids
+ [id id id id]
+
+B: id = construct id "b"
+
+parse Input: four_ids[ stdin ]
+
+for Id: id in Input {
+ if ( Id == B )
+ print( B '\n' )
+}
+##### IN #####
+a b c d
+##### EXP #####
+b