Created
June 20, 2011 18:26
-
-
Save anonymous/1036222 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# various past examples for context-sensitive node: | |
# integer constants | |
$past := PAST::Coerced.new( | |
$*ST.add_constant('Int', 'int', $<integer>.ast), #default | |
'IiNn', $<integer>.ast #native | |
); | |
# num constants | |
$past := PAST::Coerced.new( | |
$*ST.add_constant('Num', 'num', +(~$/)), #default | |
'IiNn', +(~$/) #native | |
); | |
# many contexts | |
$past := PAST::Coerced.new( | |
$past, #default | |
'v', PAST::Op.new(:name('&sink'), $past), #void | |
'Ii', PAST::... #integer | |
'Nn', PAST::... #numeric | |
'Ss', PAST::... #string | |
); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment