Skip to content

Instantly share code, notes, and snippets.

@blippy
Created July 2, 2020 10:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save blippy/a93ea09c5d1d5cb42f6dd0b24f0aa91d to your computer and use it in GitHub Desktop.
Save blippy/a93ea09c5d1d5cb42f6dd0b24f0aa91d to your computer and use it in GitHub Desktop.
Creating a templating system in raku
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
@blippy
Copy link
Author

blippy commented Jul 2, 2020

A write-up is here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment