Re: Whether to Parser

2017-05-13 Thread Matthias Simon
Hi, although the second solution is simpler, I'd go with the first one. As soon as you plan to extend the grammar, for example by allowing user defined types or expressions as initialization-value, you'll run into trouble: // parser has no idea if `mytype` requires an INT_CONST mytype x =

Problems understanding %prec

2016-05-01 Thread Matthias Simon
Hi, I have a grammar with some conflicts between the return statement and the declaration (due to missing semicolons). I thought I could resolve this issue by giving the primary-production in expr a context-dependent precedence, but it had no effect on the conflicts. I still have a conflict f

Re: Is there an option to change the message produced by YYERROR_VERBOSE?

2016-04-27 Thread Matthias Simon
Hi Simon, depending on your grammar, you might treat the keyword as an identifier and just throw a warning in the lexer: "banana" { if (!SUPPORTS_KEYWORD(yyextra->config.std)) { fprintf(stderr, "warning: `banana' keyword not available\n");

Re: Is there a replacement for yychar

2015-01-15 Thread Matthias Simon
Hi Akim, On 2015-01-12 11:22, Akim Demaille wrote: However, can't you just avoid depending on yychar this way? Can't you pull out the yychar at the level of the rule itself? I hadn't thought of that, I like this solution. Thanks a lot Cheers, Matthias ___

Re: Is there a replacement for yychar

2014-12-12 Thread Matthias Simon
On 2014-12-12 12:51, Hans Aberg wrote: if [ $($BISON --version | head 1 | ...) -lt 3 ]; then write_header_config "#define yychar yyla.type” fi Right. It might suffice to put it directly in the .yy file, as later version do not seem to have yychar. Whereas later versions do not have yychar, o

Re: How to implement optional semicolon rules

2014-12-11 Thread Matthias Simon
Hi again, I want to share my solution with you and the future generations stumbling across similar problems ;) I decided implementing the exact semicolon rules was not worth the trouble: - The grammar is already quite complex and difficult to understand, changing these to respect semicolon r

Re: Is there a replacement for yychar

2014-12-11 Thread Matthias Simon
It is probably best to stick to the newer version only, to avoid bugs. Sadly, that is not really an option for me (due to outdated targets, high variety of developer-machines, difficulties with non-standard installations,...). Hence, I probably will workaround in the build-system like: if [ $

Is there a replacement for yychar

2014-12-11 Thread Matthias Simon
Hi, I have a problem compiling my parser generated by Bison 3.0.2. For error recovery I use the lookahead variable `yychar' like this: ... | error { if (yychar != '}' && yychar != ';') yyclearin; else yyerrok; } ; But in commit 39be90223b73a42d249f99cdf283c4ab46a10a21 this variable

Re: How to implement optional semicolon rules

2014-11-18 Thread Matthias Simon
Thank you for all your answers. The language I am trying to implement is quite complex, unfortunately. It has various --and also optional-- block-like structures. Hence I personally would prefer setting the context variable for the lexer, over rearranging the whole grammar just for this nagging

How to implement optional semicolon rules

2014-11-15 Thread Matthias Simon
Hi, I am struggling with some semicolon rules for some time now. In this language (TTCN3) statements end with an mandatory semicolon, except there is a curly bracket around. Example: // -8<-[SNIP!] { var integer a; var integer b[2] := { 23, 5 }