Skip to content

Instantly share code, notes, and snippets.

@jawher
Created December 26, 2010 17:47
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 jawher/755534 to your computer and use it in GitHub Desktop.
Save jawher/755534 to your computer and use it in GitHub Desktop.
grammar ImmanixToStringDebug;
options {
output=AST;
ASTLabelType=CommonTree;
}
p : m;
m : (LP! binop RP! rep^?) | (LB! binop RB!) |SM;
binop : m (op^ m)*;
op : LSUCC | RSUCC | SUCC;
rep : '*';//'{' ('0'..'9')+ '}';
SM : ('<' | '>' | 'a'..'z' | 'A'..'Z' | '/')+;
OPT : '?';
RP : ')';
LP : '(';
RB : ']';
LB : '[';
RSUCC : '<~';
LSUCC : '~>';
SUCC : '~';
(((SOF) ~ (<HackerNews>)) ~> ((((<row>) ~> (((((<ID>) ~> (text)) <~ (</ID>)) <~ ([((<ParentID>) ~> (text)) <~ (</ParentID>)]) ~ [((<Url>) ~> (text)) <~ (</Url>)] ~ [((<Title>) ~> (text)) <~ (</Title>)] ~ ((<Text>) ~> ([text])) <~ (</Text>) ~ ((<Username>) ~> (text)) <~ (</Username>) ~ ((<Points>) ~> (text)) <~ (</Points>) ~ ((<Type>) ~> (text)) <~ (</Type>) ~ ((<Timestamp>) ~> (text)) <~ (</Timestamp>) ~ ((<CommentCount>) ~> ([text])) <~ (</CommentCount>)))) <~ (</row>))*)) <~ ((</HackerNews>) <~ (EOF))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment