[antlr-interest] RFC: slight change in ! semantics

Ric Klaren klaren at cs.utwente.nl
Fri Oct 5 07:14:48 PDT 2001


Hi,

On Fri, Oct 05, 2001 at 04:33:16PM +0300, Ruslan Zasukhin wrote:
> > "class" since you can't reference it in actions (can't?) )
>                      ^^^^^^^^^^^^^^^^^^ only after adding label I think.

Indeed doesn't work tested it just now.

> Yes, 3) is not yet optimal but make things better that right now. Agree.
> So this is the minimal target you should do.

Just finished figuring out how to do this and doing some tweaking. Unless
the general opinion goes another direction than 3.

> And if this is not huge amount of work, why not to make it configurable and
> WRITE DOWN that ANTLR in future versions will go to this more optimal way.
> On default optimization must be OFF, for existed grammars. Everybody who
> develop new grammar will set it ON and will enjoy by better code.

See my opinion on making it configurable I'm not doing it (nor accepting
patches for it).

> BTW, I still wonder on internal generation code algorithm.
> I have not yet look into code, but it very sounds to me that
> ANTL read some token of grammar and immediately generate code.

It's indeed an one-pass-ish implementation and yes it's unpractical. After
2.7.2 I'll start restructuring things for 3.0, after hacking around this
latest optimization I must say I'm sick and tired of it. Multipass parsing
will certainly be a feature in 3.0.

> Why ???

>
> Why the GREAT tool that we all use to make compilers,
> in most cases the multi-pass compilers:
> -- parse and build AST for the whole file
> -- optimize tree
> -- generate code
>
> can not self do this in several passes ???

Because we have to rewrite it (at least partly) to do this. And there's no
one paid to do this, so I guess no one get's annoyed enough with the
current implementation to do some rewriting, since we're all very busy ppl,
so we keep having a one pass thing. After the 2.7.2 release I for one am
going to do some restructuring, I don't want to kludge around these
limitations anymore.

> Why ANTLR can not parse the whole grammar and build in RAM AST tree,
> later analyze and optimize tree, and only after this generate PERFECT code.

Of course this is possible it only needs to be done see time remarks above.

> I do not think that looking into semantic action to see WHAT tokens are used
> in it is bad idea.

It isn't only in the current implementation it's a d*mn PITA. And basically
not worth doing, because around every corner you'll run into another
problem.

> I WANT THIS TO SEE IN NEAREST ANTLR versions !!!  :-)

Somewhere in 5 years a 2.7.2 release, seems like a nice schedule for a
perfect version ? >:-(

Ric
--
-----+++++*****************************************************+++++++++-------
    ---- Ric Klaren ----- klaren at cs.utwente.nl ----- +31 53 4893722  ----
-----+++++*****************************************************+++++++++-------
 Time what is time - I wish I knew how to tell You why - It hurts to know -
          Aren't we machines - Time what is time - Unlock the door
               - And see the truth - Then time is time again
                From: 'Time what is Time' by Blind Guardian

 

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



More information about the antlr-interest mailing list