Yacc grammar

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Yacc grammar

Samir A. Mohamed
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
[hidden email]
http://lists.nongnu.org/mailman/listinfo/grammatica-users
Reply | Threaded
Open this post in threaded view
|

Re: Yacc grammar

Oliver Bock
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 [hidden email] http://lists.nongnu.org/mailman/listinfo/grammatica-users


_______________________________________________
Grammatica-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/grammatica-users
Reply | Threaded
Open this post in threaded view
|

Re: Yacc grammar

Samir A. Mohamed
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 <[hidden email]> 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 [hidden email] http://lists.nongnu.org/mailman/listinfo/grammatica-users


_______________________________________________
Grammatica-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/grammatica-users



_______________________________________________
Grammatica-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/grammatica-users
Reply | Threaded
Open this post in threaded view
|

Re: Yacc grammar

Oliver Bock
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 <[hidden email]> 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 [hidden email] http://lists.nongnu.org/mailman/listinfo/grammatica-users


_______________________________________________
Grammatica-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/grammatica-users


_______________________________________________ Grammatica-users mailing list [hidden email] http://lists.nongnu.org/mailman/listinfo/grammatica-users


_______________________________________________
Grammatica-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/grammatica-users
Reply | Threaded
Open this post in threaded view
|

Re: Yacc grammar

Per Cederberg
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 <[hidden email]> 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 <[hidden email]> 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
>> [hidden email]
>> http://lists.nongnu.org/mailman/listinfo/grammatica-users
>>
>>
>> _______________________________________________
>> Grammatica-users mailing list
>> [hidden email]
>> http://lists.nongnu.org/mailman/listinfo/grammatica-users
>>
>
>
> _______________________________________________
> Grammatica-users mailing list
> [hidden email]
> http://lists.nongnu.org/mailman/listinfo/grammatica-users
>
>
> _______________________________________________
> Grammatica-users mailing list
> [hidden email]
> http://lists.nongnu.org/mailman/listinfo/grammatica-users
>
>


_______________________________________________
Grammatica-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/grammatica-users