[antlr-interest] ANTLRWorks GUI dev environment videos

Loring Craymer Loring.G.Craymer at jpl.nasa.gov
Sun Apr 10 01:27:27 PDT 2005


Ter--

This looks like a very good start.  I've got a few feature requests:

REFACTORING SUPPORT
The basic refactorings for parser/lexer grammars (they also apply to tree
grammars, but I can identify a much richer set of tree refactorings) that
can be easily implemented include
1.)  Rule renaming (all references are renamed)
2.)  Extract rule (replaces "all" instances of a given token sequence with a
rule reference--user should get yes/no choices for each instance)
3.)  Inline rule (case-by-case or global)
4.)  Clone rule (Copies and renames a rule definition; user is given
opportunity to select which version applies for every reference to the
original rule).  Usually, the cloned rule will then be "specialized" to have
a different set of actions and/or attributes from the original rule.
5.)  Transform loop to recursion
6.)  Transform recursion to loop.

And, with only a little more effort
7.)  Left factor alternatives in rule.

One big advantage grammars have for refactoring is that you do not have much
semantic state to worry about; I'd be very surprised if it took more than a
few days to implement all of the above functionality--especially considering
that most of the underlying support routines are probably already present.

SOURCE-TO-SOURCE manipulations
There is quite a bit that can be done simply by regenerating grammars with
addition/subtraction of features with what should be minimal effort.  It
would be nice if some of these were supported at the editing level.
1.)  Extract/import target source:  This would be to enable refactoring of
action code.  Basically, the idea is to extract the usual block of action
code (methods) plus all actions (including semantic predicates).  The action
snippets would be extracted as methods, perhaps named <rule>action<n> (the
naming should make re-import easy).
2.) pre-Aspect ANTLR:  Insert actions after ':' or before ';', before/after
'(', ')', ')+', ')*', ')?' in cloned grammar.  This, coupled with
extract/inline rule, encompasses most of the functionality of an Aspect
ANTLR; additionally making the insertion dependent on finding a sequence of
token types would provide most of the remaining support needed.  (Note that
this provides a simple mechanism for the "traceIn/traceOut" feature of ANTLR
2 and PCCTS).  Monty might have some further suggestions.
3.)  Test rule generator:  clone the grammar, adding a top-level rule which
has each rule as an alternative, with a preamble.  (The preamble might
recognize "test" <rule> and then a sequence of tokens representing a test
case.

These require more effort than the refactoring support, but the added
capability would probably be more than worth the effort.

--Loring


> -----Original Message-----
> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> bounces at antlr.org] On Behalf Of Terence Parr
> Sent: Friday, April 08, 2005 2:31 PM
> To: ANTLR Interest
> Subject: [antlr-interest] ANTLRWorks GUI dev environment videos
> 
> Howdy folks,
> 
> Jean Bovet has made some short videos of ANTLRWorks in action.  We gave
> a presentation to the smarties at BEA yesterday on ANTLR/StringTemplate
> and ANTLRWorks.  Went over well according to feedback. :)
> 
> Jean has made just insane progress in 2 months.  We expect an early
> access release with ANTLR v3 in May probably.
> 
> ANTLRWorks only works with v3 and is not yet integrated into any IDEs
> like Eclipse or Intellij.
> 
> http://www.antlr.org/works/index.html
> 
> Enjoy :)
> 
> Ter
> --
> CS Professor & Grad Director, University of San Francisco
> Creator, ANTLR Parser Generator, http://www.antlr.org
> Cofounder, http://www.jguru.com
> 




More information about the antlr-interest mailing list