On Jul 1, 2013, at 12:19 PM, Chris Cunningham <cunningham.cb(a)gmail.com> wrote:
So, yes, stick
to the language spec. Some PhD student will be glad for it at some later time!
The
parser - yes, absolutely, 100% agree. How Java compilers parse it is show we should part
it.
What is less clear to me is what the AST model should look like. In PetitJava, we have a
PPJavaSyntax that will parse the java file, ideally just like the compiler will. It leave
a bare parse tree in it wake.
We also have a PPJavaParser, which takes that raw parsing and builds an AST
representation. As was pointed out by Yuriy Tymchuk, I'd prefer a more compact
representation of the parsed results instead of the more granular results. Although
either would work - it's just that for my purposes, the more compact makes it easier
to get at the information that I want. They should both be valid, though.
My vote, if I would have had one as a PhD student that long ago, would be to have the bare
parse tree, with a 1-to-1 correspondence with the specification. If there is a
specification, of course. I'm not speaking about the case of Delphi, I have no
experience with it whatsoever.
I prefer no optimizations whatsoever because they come at the cost of less (or less
straightforward) functionality. Of course this may not work for everybody (e.g. space
& time issues when processing). So I understand the need for more compact
representations. Yet one should be careful that the compact representation, if used a lot,
will in the end become the 'standard' way of doing things, making the bare parse
tree become the unpopular child of the family, with all the negative effects that this
induces.
That's all I'll comment about this subject for now, and leave you guys to actually
do things. What I did that looong time ago was fun, but I have moved on to other things
meanwhile, so I don't mean to drag this discussion on ;-)
---> Save our in-boxes!
http://emailcharter.org <---
Johan Fabry -
http://pleiad.cl/~jfabry
PLEIAD lab - Computer Science Department (DCC) - University of Chile