[antlr-interest] "Best practice" for contructing AST

John D. Mitchell johnm-antlr at non.net
Sat Sep 18 11:55:14 PDT 2004


>>>>> "Paul" == Paul J Lucas <pauljlucas at mac.com> writes:
[...]

> 	Method 2 differs from Method 1 in that there's no ATTRIBUTE_LIST.
> It's not strictly needed since one "knows" that attibutes always come
> before element content.

> 	But does eliding ATTRIBUTE_LIST generally make things easier or
> harder?

IME, it's almost always better to have the list.  By pushing down the
variability (i.e., elements may have a variable number of attributes) one
level, everything at the element level is fixed.  That makes it easy, fast,
and reliable to get any of the fields -- e.g., the element's content would
be the third child.

Hope this helps,
		John



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
    antlr-interest-unsubscribe at yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 





More information about the antlr-interest mailing list