Skip to content

Instantly share code, notes, and snippets.

@samuraisam
Created June 14, 2013 00:39
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 samuraisam/5778599 to your computer and use it in GitHub Desktop.
Save samuraisam/5778599 to your computer and use it in GitHub Desktop.
grammar PB::Grammar {
token TOP { ^ [\s+]? <proto> [\s+]? $ }
token proto { [<message> | ';'] }
token message { 'message' \s+ <ident> \s+ <message-body> [\s+]? }
token ident { \w+ }
token message-body { '{' [\s+]? [<message>+]? [\s+]? '}' }
}
say PB::Grammar.parse('
message fart {
message butt {}
message butt2 {
message inner_butt {}
}
}'
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment