Skip to content

Instantly share code, notes, and snippets.

@jminer
Created March 19, 2012 23:59
Show Gist options
  • Save jminer/2128672 to your computer and use it in GitHub Desktop.
Save jminer/2128672 to your computer and use it in GitHub Desktop.
import pegged.grammar;
import std.stdio;
mixin(grammar(`
FloatLiteral <~ DecLiteral ('e' [+-]? ([0-9] [0-9]*))?
DecLiteral <- [0-9] [0-9]*
`));
void main() {
auto str = "3e2";
auto tree = FloatLiteral.parse(str);
writefln("Tree: %s", tree);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment