Last active
December 15, 2015 14:08
-
-
Save colomon/5271962 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
# use Grammar::Tracer; | |
grammar G { | |
token TOP {^ <integer-constant> $}; | |
proto token integer-constant {*}; | |
token integer-constant:sym<8> { <octal-constant> }; | |
token integer-constant:sym<10> { <decimal-constant> }; | |
token integer-constant:sym<16> { <hexadecimal-constant> }; | |
token octal-constant { '0' <odigit>* }; | |
token decimal-constant { <nzdigit> <digit>* }; | |
token hexadecimal-constant { <.hexadecimal-prefix> <xdigit>* }; | |
token hexadecimal-prefix { '0' <[xX]> }; | |
token nzdigit { <[1..9]> }; | |
token odigit { <[0..7]> }; | |
} | |
say G.parse('0'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment