Skip to content

Instantly share code, notes, and snippets.

@felher
Last active December 16, 2015 03:59
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 felher/5373428 to your computer and use it in GitHub Desktop.
Save felher/5373428 to your computer and use it in GitHub Desktop.
What do you think about this layout? It's pretty useless for big grammars or grammars with more complex layout of course, but it might be good for some small grammars like this. One immediately sees the hierarchical layout. I'm not sure I like the layout myself.
grammar Rules {
token TOP { <line>* }
token line { <empty-line> | <field-specification-line> | <tag-line> }
token empty-line { [ '#' \V* ]? \v }
token field-specification-line { '!' <field-name> \v }
token field-name { 'to' | 'from' | 'subject' }
token tag-line { <tag-command> \h+ <conjunction>+ % [\h* '|' \h*] \v }
token tag-command { <sign> <tag-name> }
token sign { ['+' | '-'] }
token tag-name { <alnum>+ }
token conjunction { <condition_atom>+ % [\h+] }
token condition_atom { <+alnum +[.@-]>+ }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment