diff options
Diffstat (limited to 'test/context1.lm')
-rw-r--r-- | test/context1.lm | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/test/context1.lm b/test/context1.lm new file mode 100644 index 0000000..2832045 --- /dev/null +++ b/test/context1.lm @@ -0,0 +1,39 @@ +##### LM ##### + +context ctx + i: int + j: int + k: int + + lex + ignore /space+/ + literal `* `( `) + token id /[a-zA-Z_]+/ + end + + def foo [id] + + def item + [id] + | [foo] + | [`( item* `)] + { + i = 0 + j = i + 1 + k = j + 1 + print( k '\n' ) + } + + def start + [item*] +end # ctx + +cons CTX: ctx[] +parse Input: ctx::start( CTX ) [ stdin ] +print( Input ) + +##### IN ##### +a b c ( d e f ) +##### EXP ##### +2 +a b c ( d e f ) |