lalr

Is there a good yacc/bison type LALR parser generator for .NET ?

Thanks in advance. ...

How to fix YACC shift/reduce conflicts from post-increment operator?

I'm writing a grammar in YACC (actually Bison), and I'm having a shift/reduce problem. It results from including the postfix increment and decrement operators. Here is a trimmed down version of the grammar: %token NUMBER ID INC DEC %left '+' '-' %left '*' '/' %right PREINC %left POSTINC %% expr: NUMBER | ID | ...

How to resolve a shift-reduce conflict in unambiguous grammar

I'm trying to parse a simple grammar using an LALR(1) parser generator (Bison, but the problem is not specific to that tool), and I'm hitting a shift-reduce conflict. The docs and other sources I've found about fixing these tend to say one or more of the following: If the grammar is ambiguous (e.g. if-then-else ambiguity), change the l...

Left Recursion in Grammar Results in Conflicts

Throughout a Bison grammar I am using right recursion, and I have read that left recursion is better because it doesn't have to build the whole stack first. However, when I try to switch to left recursion on any of them, I always end up with a lot of conflicts, and I am not seeing why. Can anyone show me a generic example of where usin...

Resolving a shift/reduce conflict in an LALR parser

I've been using PLY to build up a parser for my language, however I've got a shift/reduce conflict that's causing me some trouble. My language has generic types with a syntax ala C++ templates. So right now I have rules like: expression : expression LESS expression %prec COMPARISON expression : template template : NAME ...

LALR(2) dangling else

Hello Is LALR(2) able to handle the dangling else case naturally (without any special rules, as with LALR(1))? Thanks ...

What is the best LALR parser generator for C++ that can generate meaningful error messages

I am looking for the best solution for a LALR parser generator for C++ that will allow me to generate really good error messages. I really hate the syntax errors that MySQL generates and I want to take the parser in it and replace it with a "lint" checker that will tell me more than just ERROR 1064 (42000): You have an error in your S...

CUP generates many shift-reduce confilcts...

Hi everyone, I want to build parser with CUP tool... I've built LALR(1) grammar from language specification but it seems that I've done it wrong. When CUP generates parser it shows many shift-reduce conflicts that unfortunately causes faulty notifications of syntax errors... I guess that resolving SF conflicts in favor of shift causes t...

LALR(1) empty list of parameters for functions

Hi I have a simple LALR(1) grammar, but I'm encountering a problem. start ::= spec. spec ::= MOD STRING top_stmt. spec ::= top_stmt. top_stmt ::= stmt. top_stmt ::= conditional. stmt ::= expr. stmt ::= assignment. conditional ::= IF stmt_list. expr ::= retval. expr ::= NOT retval. retval ::= access. retval ::= invoke. access ::= ns_ide...

LALR(1) or GLR on Windows - Alternatives to Bison++ / Flex++ that are current?

I have been using the same version of bison++ (1.21-8) and flex++ (2.3.8-7) since 2002. I'm not looking for an alternative to LALR(1) or GLR at this time, just looking for the most current options. Is anyone aware of any later ports of these than the original that aren't Cygwin dependent? What are other folks using in Windows environme...

Implementing eval and load functions inside a scripting engine with Flex and Bison.

Hy guys, i'm developing a scripting engine with flex and bison and now i'm implementing the eval and load functions for this language. Just to give you an example, the syntax is like : import std.*; load( "some_script.hy" ); eval( "foo = 123;" ); println( foo ); So, in my lexer i've implemented the function : void hyb_parse_string...

How to solve a shift/reduce conflict?

Hi, I'm using CUP to create a parser that I need for my thesis. I have a shift/reduce conflict in my grammar. I have this production rule: command ::= IDENTIFIER | IDENTIFIER LPAREN parlist RPAREN; and I have this warning: Warning : *** Shift/Reduce conflict found in state #3 between command ::= IDENTIFIER (*) and command :...

LALR Parser Generator Implementation Problem

Hi everyone! I'm currently trying to implement a LALR parser generator as described in "compilers principles techniques and tools" (also called "dragon book"). A lot already works. The parser generator is currently able to generate the full goto-graph. Example Grammar: S' --> S S --> C C ...

Packrat parsing vs. LALR parsing

A lot of websites states that packrat parsers can parse input in linear time. So at the first look they me be faster than LALR parser contructed by the tools yacc or bison. I wanted to know if the performance of packrat parsers is better/worse than the performance of LALR parser when tested with common input (like programming language s...

Template class using Gold Parser and the Klimstra engine...

I'm using Klimstra's VB.NET template from the "Create skeleton program" of the GOLD parser but the resulting template has methods with the overrides keyword and inherits from "TemplateParser".. that kind of threw me off, am I supposed to create the TemplateParser class or is there a tool to create it? I thought that the "create skeleton"...

How can I remove the function call ambiguity from a Lemon grammar?

I have the following lemon grammar (simplified from the real grammar): %right ASSIGN . %nonassoc FN_CALL . program ::= expression . expression ::= expression ASSIGN expression . expression ::= function_call . [FN_CALL] expression ::= IDENTIFIER . function_call ::= expression LPAREN RPAREN . [FN_CALL] I'm not able to fix the shift-r...