Skip to content

Instantly share code, notes, and snippets.

@tobinharris
Created May 23, 2009 15:39
Show Gist options
  • Save tobinharris/116663 to your computer and use it in GitHub Desktop.
Save tobinharris/116663 to your computer and use it in GitHub Desktop.
grammar ActivityDiagram
rule diagram
phrase
end
rule phrase
node (connector node)*
end
rule node
activity / parallel / decision
end
rule activity
'(' label:[a-zA-Z]+ ')'
end
rule parallel
'|' label:[a-zA-Z]+ '|'
end
rule decision
'<' label:[a-zA-Z]+ '>'
end
rule connector
(left_arrow)? (left_label)? '-' (right_label)? (right_arrow)?
end
rule left_arrow
'<'
end
rule right_arrow
'>'
end
rule left_label
line_label
end
rule right_label
line_label
end
rule line_label
[a-zA-Z_0-9]+
end
rule comma
','
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment