On 01/18/2012 02:26 PM, Terence Parr wrote:
> Hi. I didn't see an example really where it shows it creating something other
> than a simple parse tree.
Well AFIAK that is all BNFC does - create a parse tree. It remains
target language agnostic by not permitting any actions - is that what
you wanted to see?
> Can you point me an example?
I can post examples, but they won't be really any different than the
examples given at the bottom of BNFC's web page (as cited below).
so it goes really Old School by not using any form of EBNF but rather
traditional productions. No meta-syntax for alternatives, optional
elements, looping elements. And not actions.
or rather it has a different meta-syntax to support alternatives and
looping elements.
alternatives are given by productions having the same non-terminal name
as their left-hand identifier. and then there is a, kinda funky but very
haskell-like, special meta-syntax for looping constructs.
I would expect that you would add meta-syntax for actions. so perhaps a
rule is something like
<Constructor>. <Non-Terminal> ::= <Production-RHS> ;
{<Optional-Action-in-Target-Language>}
envision appropriate stuff for the <...> thingys above. not a precise
specification.
Perhaps the lack of actions and EBNF constructs is a non-starter?
-jbb
> T
> On Jan 11, 2012, at 7:48 PM, John B. Brodie wrote:
>
>> Sorry to reply to my own messeage...
>>
>> On 01/11/2012 10:29 PM, John B. Brodie wrote:
>>> Greetings!
>>>
>>> Have you looked at the mechanism of the BNF Converter?
>>> see http://www.cse.chalmers.se/research/group/Language-technology/BNFC/
>>>
>>> yes it is based around YACC-like lalr parser generators
>>>
>>> but i like its mechanic for tree generation
>>>
>>> i have only used it for generating Haskell
>>>
>>> it claims to produce Java (and C and C++ and ...)
>> I do not mean to advocate the data structure it generates (altho the
>> generated Haskell is not so bad).
>>
>> I am more suggesting its meta syntax used in the grammar input that in
>> turn drives creation of a tree.
>>
>> So use BNFC's meta-syntax and create a data structure you are
>> comfortable with from that...
>>
>>> hope this is not tooooo off base
>>>
>>> thankx
>>> -jbb
>>>
>> _______________________________________________
>> antlr-dev mailing list
>> [email protected]
>> http://www.antlr.org/mailman/listinfo/antlr-dev
_______________________________________________
antlr-dev mailing list
[email protected]
http://www.antlr.org/mailman/listinfo/antlr-dev