Re: AST view of E program

"Marcelo D. Ré" <[email protected]>
Newsgroups gmane.comp.lang.e.general
Message-ID <[email protected]>
Kevin Reid escribió:
> On Sep 29, 2008, at 7:49, Marcelo D. Ré wrote:
>
>   
>>    I am working in a module to support E in NetBeans. Currently it
>> sopport code highlight, braces completion, run e from the ide, and are
>> developping the syntax check.
>>    The question is: how to grab an AST from an E file? is it posible?
>>     
>
>    def makeEParser := <import:org.erights.e.elang.syntax.makeEParser>
>
>    makeEParser.run(theFile.getTwine())
>
> The result of this is an AST of type ENode.
>
> All of this can be accessed from Java too.
>
> There is one caveat: in E-on-Java, there is no reified AST for un- 
> expanded E syntax, only for Kernel-E. This may be sufficient,  
> particularly as, provided that the source is a Twine (not a String),  
> every ENode carries the line and column number of the source text  
> corresponding to it (getOptSpan).
>
>
> If it isn't, you can supply your own EBuilder (or is it ENodeBuilder?  
> One's a class and the other's an interface) to EParser and get  
> messages corresponding to the full syntax.
>
> Another option is to use the grammar from E-on-CL, which is actually  
> written in Java (generated by ANTLR), which provides an unexpanded AST.
>
>   
>> I have problem parsing the line
>>
>>              match [] { println(uri) }
>>
>>    in the counter-example.e.
>>
>>    I don't find a clause that parse the "println" statement.
>>     
>
>
> This is an ordinary function call. The Kernel-E AST for this is
>
> EMatcher
>    ListPattern
>      (no children)
>    CallExpr
>      NounExpr
>        "println"
>      "run"
>      NounExpr
>        "uri"
>
> The unexpanded AST for this in E-on-CL is
>
> EMatcher
>    ListPattern
>      (no children)
>    FunCallExpr
>      NounExpr
>        "println"
>      NounExpr
>        "uri"
>
>   
Hi

    I have problem to print the AST. I couldn't find the way to do this. 
Where is the class or method makeEParse? I didn't find it in the JavaDoc 
(http://www.erights.org/javadoc/index.html) son I could modify the 
program to print the AST.
    I try diferent ways but could not get it work. Could somebody help 
me? I need a program that print the on console AST view of a source.
    I have most of the syntax check working in my plugin but currently 
have a problem parsing the expresion:

    def x4k3 := (x10 * 4).keep(3)
   
    of the diceIt.e

    Thank

       Marcelo

_______________________________________________
e-lang mailing list
[email protected]
http://www.eros-os.org/mailman/listinfo/e-lang
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.