Created
February 17, 2011 06:19
-
-
Save treed/831135 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
grammar Assembly { | |
rule TOP { ^ <statement>+ $ } | |
rule statement { | |
<operator> <operand> $$ | |
} | |
rule operator { | |
| lda | |
| ldx | |
| ldy | |
} | |
token operand { | |
'#' <number> # immediate mode | |
} | |
token number { | |
| 25<[0..5]> | |
| 2<[0..4]><[0..9]> | |
| 1<[0..9]><[0..9]> | |
| <[1..9]><[0..9]> | |
| <[0..9]> | |
} | |
} | |
Assembly.parse("lda #27\nldx #35"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment