Created
April 18, 2009 13:37
-
-
Save anonymous/97609 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
## This is my attempt at writing a simple grammar in perl6 | |
class EasyCMS::Template { | |
method render (Str $in, %vars) { | |
my $parsetree = $in ~~ m/<EasyCMS::Template::Grammar.template>/; | |
warn $parsetree.perl; | |
return $in; | |
} | |
} | |
grammar EasyCMS::Template::Grammar { | |
rule template { <statement>* } | |
rule statement { <expression> | <text> } | |
token text { [\w | \s]+ } | |
rule expression { \[ \% \s? <command> \s? \% \] } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment