grammatica-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Grammatica-users] Yacc grammar


From: Per Cederberg
Subject: Re: [Grammatica-users] Yacc grammar
Date: Mon, 8 Feb 2010 08:11:58 +0100

Yacc is LALR(1), whereas Grammatica is LL(k). So rewriting the
grammars is not quite to easy to do automatically.

The precedence operators are not really needed for an LL(k) grammar.
You use different productions to get the same effect:

Expr1 = Expr2 ["+" Expr1] ;
Expr2 = Expr3 ["*" Expr2] ;
Expr3 = <NUMBER> ;

Cheers,

/Per

On Mon, Feb 8, 2010 at 05:37, Oliver Bock <address@hidden> wrote:
> I have not needed anything like this in Grammatica, although I have some
> vague memory of using them in YACC about 15 years ago.  Perhaps you can
> restructure your grammar to get the same effect, although I don't know how.
>
>
> On 8/02/2010 3:32 PM, Samir A. Mohamed wrote:
>
> I'm not sure how to convert the precedence statements in Yacc grammar into
> Grammatica like:
> %right TPREINCR TPREDECR
> %left '.' PPAREN
> %glr-parser
> Any ideas?
> On Sun, Feb 7, 2010 at 11:23 PM, Oliver Bock <address@hidden> wrote:
>>
>> Very unlikely, I would say.  Doesn't YACC let you embed C code in your
>> parser?  You will have to hand-translate that stuff so you may as well do it
>> all manually anyway.
>>
>>
>>   Oliver
>>
>> On 8/02/2010 2:58 PM, Samir A. Mohamed wrote:
>>
>> Folks,
>> I just joined the mailing list and I'm wondering if there is a tool that
>> can convert a Yacc grammar to Grammatica grammar format?
>> thnx,
>> Samir
>>
>> _______________________________________________
>> Grammatica-users mailing list
>> address@hidden
>> http://lists.nongnu.org/mailman/listinfo/grammatica-users
>>
>>
>> _______________________________________________
>> Grammatica-users mailing list
>> address@hidden
>> http://lists.nongnu.org/mailman/listinfo/grammatica-users
>>
>
>
> _______________________________________________
> Grammatica-users mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/grammatica-users
>
>
> _______________________________________________
> Grammatica-users mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/grammatica-users
>
>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]