Re: Tokens to patterns?

2020-12-31 Thread Christian Schoenebeck
On Mittwoch, 30. Dezember 2020 18:44:54 CET Maury Markowitz wrote: > Early imperative languages like FORTRAN and BASIC are marked by a large > number of keywords. In my bison code I have pages of %token lines for PRINT > and INPUT etc, which I then replicate in my flex with something like PRINT > {

Re: Reporting malloc failure in actions

2020-12-31 Thread Christian Schoenebeck via Users list for the GNU Bison parser generator
On Mittwoch, 30. Dezember 2020 19:50:05 CET Joe Nelson wrote: > > void* p = malloc(n); > > if (!p) { > > > > fprintf(stderr, "Parser: malloc(%s) with size %zu failed. > > Aborting. \n", > > > > expr, n); > > Might be more flexible to call

Re: Reporting malloc failure in actions

2020-12-31 Thread Joe Nelson via Users list for the GNU Bison parser generator
Christian Schoenebeck wrote: > > #ifdef YYNOMEM > > /* newer bison version */ > > YYNOMEM; > > #else > > /* older bison (undocumented feature) */ > > goto yyexhaustedlab; > > #endif > > You would be dealing with internals, but AFAICS that internal label > already exists for decades

Re: Tokens to patterns?

2020-12-31 Thread Akim Demaille
Hi Christian, > Le 31 déc. 2020 à 14:27, Christian Schoenebeck a > écrit : > > That even seems to work in combination with type specifiers and string > literals: Yes, and that's documented and stable. > %token ONE "one" > %token TWO "two" > %token THREE "three" > > -> > > %token ONE "o

Re: %merge confusion

2020-12-31 Thread Akim Demaille
Jot, > Le 30 déc. 2020 à 10:18, Jot Dot a écrit : > >>> I get the same yyuserMerge as before. This time, it is using >>> the new type of the rule that the merge is in (%type rule) >>> >>> case 1: yy0->index = stmtMerge (*yy0, *yy1); break; >> >> Which is good. That is what is expected. > >