Created
July 2, 2020 10:26
-
-
Save blippy/a93ea09c5d1d5cb42f6dd0b24f0aa91d to your computer and use it in GitHub Desktop.
Creating a templating system in raku
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 G { | |
token TOP { <atom>* } | |
token atom { IFX { print "\n.. GOT IFX..\n"; } | |
| IF {print "\n--GOT IF--\n"; } | |
| . { print $/; } | |
} | |
} | |
my $str = "heIFllIFXo\n"; | |
G.parse($str); | |
# outputs | |
# he | |
# --GOT IF-- | |
# ll | |
# .. GOT IFX.. | |
# o | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A write-up is here.