Re: keywords in grammars

2019-12-26 Thread Brian Duggan
On Wednesday, December 25, Alt Mcarter wrote: > But I'm wondering, is there a way to write token var in such a way that it > matches <[a..z]>+ EXCEPT when it is a keyword (print, for, to, next, etc.)? You could use a negative code assertion -- #!/usr/bin/env raku my @keywords = ; grammar

keywords in grammars

2019-12-25 Thread Alt Mcarter
I'm trying to write a toy BASIC to assembler. Here's my code so far: grammar G {     rule TOP    { }     rule stmts  { * }     rule statement  { | | }     rule print-stmt { 'print' }     rule for-loop   { 'for' '=' 'to'   'next' }     rule assign { '