] must-fail
{ V{ V{ 49 } "+" V{ 49 } } } [
- #! Test direct left recursion.
- #! Using packrat, so first part of expr fails, causing 2nd choice to be used
+ #! Test direct left recursion.
+ #! Using packrat, so first part of expr fails, causing 2nd choice to be used
"1+1" [EBNF num=([0-9])+ expr=expr "+" num | num EBNF]
] unit-test
{ V{ V{ V{ 49 } "+" V{ 49 } } "+" V{ 49 } } } [
- #! Test direct left recursion.
- #! Using packrat, so first part of expr fails, causing 2nd choice to be used
+ #! Test direct left recursion.
+ #! Using packrat, so first part of expr fails, causing 2nd choice to be used
"1+1+1" [EBNF num=([0-9])+ expr=expr "+" num | num EBNF]
] unit-test
{ V{ V{ V{ 49 } "+" V{ 49 } } "+" V{ 49 } } } [
- #! Test indirect left recursion.
- #! Using packrat, so first part of expr fails, causing 2nd choice to be used
+ #! Test indirect left recursion.
+ #! Using packrat, so first part of expr fails, causing 2nd choice to be used
"1+1+1" [EBNF num=([0-9])+ x=expr expr=x "+" num | num EBNF]
] unit-test
serialized get [ assoc-size swap ] keep set-at ;
: object-id ( obj -- id )
- #! Return the id of an already serialized object
+ #! Return the id of an already serialized object
serialized get at ;
! Numbers are serialized as follows:
IN: peg.javascript.parser
#! Grammar for JavaScript. Based on OMeta-JS example from:
-#! http://jarrett.cs.ucla.edu/ometa-js/#JavaScript_Compiler
+#! http://jarrett.cs.ucla.edu/ometa-js/#JavaScript_Compiler
#! The interesting thing about this parser is the mixing of
#! a default and non-default tokenizer. The JavaScript tokenizer
#! removes all newlines. So when operating on tokens there is no
#! need for newline and space skipping in the grammar. But JavaScript
-#! uses the newline in the 'automatic semicolon insertion' rule.
+#! uses the newline in the 'automatic semicolon insertion' rule.
#!
#! If a statement ends in a newline, sometimes the semicolon can be
-#! skipped. So we define an 'nl' rule using the default tokenizer.
+#! skipped. So we define an 'nl' rule using the default tokenizer.
#! This operates a character at a time. Using this 'nl' in the parser
#! allows us to detect newlines when we need to for the semicolon
#! insertion rule, but ignore it in all other places.
IN: peg.javascript.tokenizer
#! Grammar for JavaScript. Based on OMeta-JS example from:
-#! http://jarrett.cs.ucla.edu/ometa-js/#JavaScript_Compiler
+#! http://jarrett.cs.ucla.edu/ometa-js/#JavaScript_Compiler
USE: prettyprint
color third index 2 + bitmap set-nth ;
: get-bitmap-pixel ( point array -- color )
- #! Point is a {x y}. color is a {r g b}
+ #! Point is a {x y}. color is a {r g b}
[ bitmap-index ] dip
[ nth ]
[ [ 1 + ] dip nth ]
#! Bit 1 = invaders sound 2
#! Bit 2 = invaders sound 3
#! Bit 3 = invaders sound 4
- #! Bit 4 = spaceship hit
+ #! Bit 4 = spaceship hit
#! Bit 5 = amplifier enabled/disabled
2dup 0 port5-newly-set? [ dup SOUND-WALK1 play-invaders-sound ] when
2dup 1 port5-newly-set? [ dup SOUND-WALK2 play-invaders-sound ] when
system:nano-count ;
: invaders-process ( micros gadget -- )
- #! Run a space invaders gadget inside a
+ #! Run a space invaders gadget inside a
#! concurrent process. Messages can be sent to
#! signal key presses, etc.
dup quit?>> [