[antlr-interest] AST build with input tokens out of order

Robert Jarzmik robert.jarzmik at free.fr
Sat Aug 20 10:55:03 PDT 2011


"John B. Brodie" <jbb at acm.org> writes:

> Greetings!
>
> Sorry for jumping in...

Hi John, you're most welcome, thanks for your answer.

I had a look at your proposition. It's good for the simple case I gave you, but
the complete problem still eludes me.

The complete input is : 
  STRUCT myvar1,myarr1[maxx,maxy] ( INTEGER i1; INTEGER j2; )

The expected output should be :
#(DECL_VARIABLE 'myvar1' 
  #(STRUCT
    #(DECL_VARIABLE 'i1' INTEGER)
    #(DECL_VARIABLE 'j1' INTEGER)
   )
  )
#(DECL_VARIABLE 'myarr1'
  #(ARRAY
    #(DIMS 'maxx' 'maxy')
    #(STRUCT
      #(DECL_VARIABLE 'i1' INTEGER)
      #(DECL_VARIABLE 'j1' INTEGER)
     )
    )
  )

That was the purpose of passing the type as parameter to "indentifiers", so that
the 'ARRAY' node could have as its second child the type (here the structure).

And that's why I'm still needing a bit help ...

Cheers.

--
Robert


More information about the antlr-interest mailing list