[antlr-interest] Summary/Cheat Sheet?
Lloyd Dupont
lloyd at nova-mind.com
Tue May 31 16:14:38 PDT 2005
out of pure curiosity, what's attracting a lawyer to the ANTLR tool?
----- Original Message -----
From: Gerald B. Rosenberg
To: antlr-interest at antlr.org
Sent: Wednesday, June 01, 2005 8:44 AM
Subject: [antlr-interest] Summary/Cheat Sheet?
Found this all-to-brief syntax summary in an old non-Antlr mailing list. Anyone have something similar that is more complete? In particular, including summary descriptions of the LT, LA, $, #, ##, n:TOKEN (variable reference) constructs.
Have not seen it in the Antlr.org documentation, but think that it would be a good addition.
Thanks,
Gerald
===================================================
ANTLR grammars are written in a kind of EBNF, which makes them very
readable:
rule
: TOKEN
| nonterminal
| (optional)?
| (zero_or_more)*
| (one_or_more)?
;
syntactic_predicates // finite lookahead, back-tracking
: (A A b) => A A b
| (A)* b
;
semantic_predicates
: { conditional_code; } => rule
| { conditional_code; } => rule
| foo
;
automatic Abstract Syntax Tree generation with grammar annotations (^):
mult_expr
: add_expr ((STAR^ | SLASH^) add_expr)
;
add_expr
: atom ((PLUS^ | MINUS^) atom)
;
----
Gerald B. Rosenberg, Esq.
NewTechLaw
285 Hamilton Avenue, Suite 520
Palo Alto, CA 94301-2576
650.325.2100 (office) / 650.703.1724 (cell)
650.325.2107 (facsimile)
www.newtechlaw.com
CONFIDENTIALITY NOTICE: This email message (including any attachments) is being sent by an attorney, is for the sole use of the intended recipient, and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender immediately by reply e-mail and delete all copies of this message and any attachments without retaining a copy.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20050601/d9434193/attachment.html
More information about the antlr-interest
mailing list