[prev in list] [next in list] [prev in thread] [next in thread] 

List:       groovy-dev
Subject:    Re: [groovy-dev] Facilitating
From:       Jochen Theodorou <blackdrag () gmx ! org>
Date:       2005-10-15 18:10:04
Message-ID: 435145FC.80906 () gmx ! org
[Download RAW message or body]

Benjamin Youngdahl schrieb:

> Thanks for the feedback Jochen.
> 
> One thing I wanted to clarify was that I was intending for the AST to
> always be applied to groovy semantics.  I wasn't thinking of another
> language back end.  Perhaps I'm using the wrong termonology here, and
> that wouldn't be the first time for me :), but what I'm trying to ask
> is:  why not facilitate alternate syntaxes for Groovy programs?

you amde that clear, and as I'm said I am not generally against it, but 
the usgae may be more limited than you think.

for exmaple let us say we have "1"+"2". From Java you would expect the 
result "12", in groovy we can't know, since + may be overloaded 
somewhere. So even when you transform a Javaprogram into Groovysyntax, 
it would be no Javaprogram in Groovysyntax, it would be a groovy 
program. and if you transform a groovy program into java you may have 
the problem that some things are not equal. Java does not have closures.

As I said, this does not mean that this would be a useless feature, but 
there should be a big blinking warning over this ;)

[...]
> I agree that if I want this, I should be putting the effort into
> making it happen; e.g. submitting the patches to the community for
> consideration.

take a look at AntlrParserPlugin:

     private void outputASTInVariousFormsIfNeeded(SourceUnit sourceUnit) {
         // straight xstream output of AST
         if ("xml".equals(System.getProperty("antlr.ast"))) {
             saveAsXML(sourceUnit.getName(), ast);
         }

and then use that property to generate an ast and look how it is done 
there. This moster might not be ideal for your "vision" since it's only 
a xml serialization of the ast we used for debugging.

> I'm a big fan of the open source development
> philosophy.  I just wanted to bring this up on the list to see if
> anyone could help me understand if this was a flawed idea; it seems
> like something that most languages typically have one and only one
> syntax.

as I said, if you want to, go ahead and start with it. If you need help 
ask us here or on the irc (european times), or you can directly ask me.

bye blackdrag

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic