Re: 'size_t' undeclared (first use in this function)

2015-07-24 Thread Hans Aberg
> On 24 Jul 2015, at 11:58, Tom Wang A wrote: > > Thanks very much! You are welcome! > In my system, YYSIZE_T is always defined as __SIZE_TYPE__ in the output > file(y.tab.c .*), which are compiled by bison 2.1 and bison 2.3. And > __SIZE_TYPE__ is actually a 8-byte size type on the server.

Re: 'size_t' undeclared (first use in this function)

2015-07-22 Thread Hans Aberg
> On 22 Jul 2015, at 11:17, Tom Wang A wrote: > > I encounter a compiling error with bison 2.1. The output file y.tab.c cannot > pass gcc compiling, while there is no such problem on bison 2.3. However, the > linux server which installed bison 2.1 cannot be upgraded with bison 2.3 for > some

Re: Using bison without Flex

2015-04-24 Thread Hans Aberg
> On 24 Apr 2015, at 15:47, John R. Levine wrote: >> Then, when the lexer finds it cannot scan forward anymore, by a character or >> EOS, it takes the longest match according to some rules and puts the rest >> stuff back into the stream for rescanning. > > That's not how flex works, unless yo

Re: Using bison without Flex

2015-04-24 Thread Hans Aberg
> On 24 Apr 2015, at 00:40, John Levine wrote: > > In article you write: >> >>> On 23 Apr 2015, at 16:34, brahim sahbi wrote: >> >>> can we use bison without flex by describing grammatical >>> rules for tokens(like number <- list_of_digits). >> >> A lexer like generated by Flex scans forwar

Re: Using bison without Flex

2015-04-23 Thread Hans Aberg
> On 23 Apr 2015, at 16:34, brahim sahbi wrote: > can we use bison without flex by describing grammatical > rules for tokens(like number <- list_of_digits). A lexer like generated by Flex scans forward to find the longest match which may require significant lookahead. A Bison generated parser

Re: Priorities in reduce/reduce conflicts

2015-03-12 Thread Hans Aberg
> On 12 Mar 2015, at 13:21, Zdenek Prikryl wrote: > > I have a valid reduce/reduce conflict. > Can someone give me a hint how to deal with this? See the Bison manual calculator example, sec. 10.1.6.3: keep all in the "expr" rules, adding a precedence rule for ":". For lists, etc: expr: .

Re: QUESTION: obstack, size of new chunk?

2015-01-04 Thread Hans Aberg
On 3 Jan 2015, at 21:15, Sean Nakasone wrote: > > Hi, lib/obstack.c has a function, _obstack_newchunk(). > > there's a formula used to calculate a variable new_size > > new_size = (obj_size + length) + (obj_size >> 3) + h->alignment_mask + 100; > > i understand obj_size + length, but what's t

Re: set_goto_map() has unintentional ++ operator

2014-12-29 Thread Hans Aberg
> On 29 Dec 2014, at 22:40, sean nakasone wrote: > The placement of the ++ makes it a post increment, so it's incremented after > the statement, so it should not affect the value of k. > > It's incrementing values in temp_map, but temp_map is deallocated after the > for loop, so that's why I

Re: About the version of bison

2014-12-27 Thread Hans Aberg
> On 26 Dec 2014, at 16:32, 562462...@qq.com wrote: > > Hello! > I have downloaded and installed the bison-3.0.tar.gz. But it shows 'bison > 2.3' when I check the version of my bison. Try ‘which bison’: you might be on OS X, which sets the PATH so that /usr/local/bin/, where the new bison is i

Re: Is there a replacement for yychar

2014-12-12 Thread Hans Aberg
> On 12 Dec 2014, at 14:13, Matthias Simon wrote: > > 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

Re: Is there a replacement for yychar

2014-12-12 Thread Hans Aberg
> On 12 Dec 2014, at 07:35, Matthias Simon wrote: > >> 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,

Re: Is there a replacement for yychar

2014-12-11 Thread Hans Aberg
> On 11 Dec 2014, at 19:17, Matthias Simon wrote: > > 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; } >; > >

Re: How to implement optional semicolon rules

2014-11-15 Thread Hans Aberg
> On 15 Nov 2014, at 15:25, Matthias Simon wrote: > 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!] >{ >

Re: Force bison syntax error on string constant

2014-10-24 Thread Hans Aberg
> On 24 Oct 2014, at 15:10, Bob Rossi wrote: > > Hi, > > I have a rule like this, > > output: output_variant NEWLINE { >*gdbmi_output = $1; > }; > > output: error NEWLINE { >yyerrok; > }; > > output_variant: OPEN_PAREN variable CLOSED_PAREN { >$$ = gdbmi_output_alloc(); >

Re: %destructor

2014-09-27 Thread Hans Aberg
> On 27 Sep 2014, at 04:01, Bob Rossi wrote: > > On Sat, Sep 27, 2014 at 12:23:37AM +0200, Hans Aberg wrote: >>> In the second sentence you mentioned I should write deallocators in each >>> instance matching the allocator used in the actions. THEN add >>

Re: %destructor

2014-09-26 Thread Hans Aberg
> On 26 Sep 2014, at 21:58, Bob Rossi wrote: > > On Fri, Sep 26, 2014 at 03:37:18PM +0200, Hans Aberg wrote: >>> The %destructor for result and result_list does not call free, but >>> instead calls gdbmi_result_free. gdbmi_result_free free's the result >>&

Re: %destructor

2014-09-26 Thread Hans Aberg
> On 26 Sep 2014, at 03:31, Bob Rossi wrote: > A secondary concern I had with %destructor is how it worked when lists > are used in the bison grammar. I'm concerned about a double free. For > instance, >result_list: { > $$ = NULL; >}; > >result_list: result_list COMMA result {

Re: QUESTION: is bison recursive?

2014-07-27 Thread Hans Aberg
On 27 Jul 2014, at 02:35, sean nakasone wrote: > Anyone know if bison is recursive? Meaning, does the bison build call bison? Yes, the file src/parse-gram.y is used to make the Bison parser. > The reason I'm asking is because I'm going through the bison 3.0 makefile and > I don't see where bi

Re: Interactive continuation prompting

2014-06-29 Thread Hans Aberg
On 28 Jun 2014, at 12:33, Christian Schoenebeck wrote: > On Friday 27 June 2014 18:12:34 Hans Aberg wrote: >> On 27 Jun 2014, at 14:40, Christian Schoenebeck > wrote: >>> 1. Strong separation between "lexer" and "parser" has its historical >>

Re: Interactive continuation prompting

2014-06-27 Thread Hans Aberg
On 27 Jun 2014, at 14:40, Christian Schoenebeck wrote: > 1. Strong separation between "lexer" and "parser" has its historical > reasons, but it makes things often quite problematic. Bison is synced in the first hand with Flex, but the latter does not currently belong to the GNU

Re: Interactive continuation prompting

2014-06-25 Thread Hans Aberg
On 19 Jun 2014, at 04:53, Grant McKenzie wrote: > I would eventually like to implement a simple command line interface to my > little language. I understand that I can set yyin to some stream that I > control from as-yet-to-be-implemented command line interface. That interface > would also man

Re: newbie: better approach for list processing with bison++?

2014-06-05 Thread Hans Aberg
On 5 Jun 2014, at 02:46, Grant McKenzie wrote: > newbie alert... This is the list for Bison [1], which supports C++ - see the manual. 1. https://gnu.org/software/bison/ ___ help-bison@gnu.org https://lists.gnu.org/mailman/listinfo/help-bison

Re: Having problems with updating the version of bison on mac

2014-05-17 Thread Hans Aberg
On 16 May 2014, at 13:03, Niklas wrote: > I need bison 3.0 and I downloaded the tar.gz-File from the homepage and run > "./configure; make; make install" just as the INSTALL-File-Instructions are > given. However, if I type "bison --version" into the terminal it shows this: > > "bison (GNU Bis

Re: Can I nest compilation of files?

2014-03-14 Thread Hans Aberg
On 14 Mar 2014, at 07:50, Anaswara Nair wrote: > I'm using BISON to create a parser for a new language more or less similar > to Ada. I wanted to nest compilation of different files and store the > variables used in each variables in a structure so that it is available for > other files too. > Wh

Re: sticking custom meta informations to grammar rules

2014-01-30 Thread Hans Aberg
On 30 Jan 2014, at 17:55, Christian Schoenebeck wrote: > On Thursday 30 January 2014 18:03:28 Hans Aberg wrote: >> I recall some others in the past that have written on interactive parsers >> showing completions. So it may be of interest integrating it into Bison. > >

Re: sticking custom meta informations to grammar rules

2014-01-30 Thread Hans Aberg
On 30 Jan 2014, at 15:15, Christian Schoenebeck wrote: > On Wednesday 29 January 2014 23:11:28 Hans Aberg wrote: >> It seems that your should use LR(1); see the Bison manual, sec. 5.8.1, "LR >> Table Construction". Bison by default uses LALR(1), which merges the >

Re: sticking custom meta informations to grammar rules

2014-01-29 Thread Hans Aberg
On 29 Jan 2014, at 18:48, Christian Schoenebeck wrote: > Hi everybody! Hi! > I am currently working on a shell and wrote custom C++ code that takes > Bison's > symbol stack at a certain point (i.e. when an error occured) and walks ahead > the Bison generated yyfoo tables / tree of the shell

Re: Tell a rule to shift instead of reduce?

2013-12-18 Thread Hans Aberg
[Please cc the list.] On 18 Dec 2013, at 23:45, Adam Smalin wrote: > >The token precedences apply to the tokens immediately before and after the > >parsing ‘.’ (as in the .output file) in the shift/reduce conflicting rules. > >The grammar must be written so that the tokens appear in such a pos

Re: Tell a rule to shift instead of reduce?

2013-12-18 Thread Hans Aberg
[Please cc the list.] On 18 Dec 2013, at 11:05, John P. Hartmann wrote: > Isn't the grammar context sensitive? No way that can be shoehorned into > LALR(1). Computer languages are typically context sensitive, but that is pushed into the actions.

Re: Tell a rule to shift instead of reduce?

2013-12-18 Thread Hans Aberg
[Please avoid styled text.] On 18 Dec 2013, at 02:05, Adam Smalin wrote: > I don't believe that works. According to my rules and the conflict files it > REFUSES to shift. "var, var = var" I think will work but "var = var, var" > will be seen as rval ',' rval which isn't legal. I'm not sure whe

Re: Tell a rule to shift instead of reduce?

2013-12-17 Thread Hans Aberg
On 17 Dec 2013, at 09:25, Adam Smalin wrote: > I still need help with this. I rewrote it maybe this will be more clear? > > I want to allow this > > var = var > var, var = var > var = var, var If you can do dynamic type checking, it suffices to write rules (as in the Bison manual calculator e

Re: rule cycle and reduce/reduce conflict

2013-11-19 Thread Hans Aberg
On 19 Nov 2013, at 09:50, Florent Teichteil wrote: > One question though: why do the precedence levels of operators '!' and > '=' defined at the beginning of my grammar don't apply in this case? > Moreover, I thought that ambiguous associativity was more likely to > create shift/reduce conflicts

Re: Regarding Compiler Construction using Bison

2013-07-06 Thread Hans Aberg
On 6 Jul 2013, at 15:00, vijay reddy wrote: > I am Vijay from Andhra Pradesh, India. I have taken up a small project > to construct a compiler for a simple language which supports just functions > that can include assignment statements, function calls, and addition, > subtraction, multiplicatio

Re: Reduce-Reduce problem choosing a path

2013-05-30 Thread Hans Aberg
On 30 May 2013, at 22:02, Adam Smalin wrote: > Here is an example of my input > > thing { $var.member } > > The problem is I allow > > thing { .member $var } > > So what is happening is I'd LIKE to always use $var.member but it can > reduce $var then .member which should not be allowed if $va

Re: %prec doesn't seem to work?

2013-04-04 Thread Hans Aberg
On 4 Apr 2013, at 14:48, Akim Demaille wrote: > Le 3 avr. 2013 à 20:28, Hans Aberg a écrit : > >> On 3 Apr 2013, at 04:52, Adam Smalin wrote: >> >>> ... I have no idea how i can fix this without rewriting it all. >> >> Have you tried getting t

Re: %prec doesn't seem to work?

2013-04-04 Thread Hans Aberg
ill be fixed by the lexer, so the precedence problem will not appear. > On Wed, Apr 3, 2013 at 2:28 PM, Hans Aberg wrote: > On 3 Apr 2013, at 04:52, Adam Smalin wrote: > > > ... I have no idea how i can fix this without rewriting it all. > > > Have you tried getting the l

Re: %prec doesn't seem to work?

2013-04-03 Thread Hans Aberg
On 3 Apr 2013, at 04:52, Adam Smalin wrote: > ... I have no idea how i can fix this without rewriting it all. Have you tried getting the lexer to emit two '>' when it sees a ">>", say by using an parenthesis-matching integer count? Hans ___ help-

Re: Solving >> issue in templates

2013-02-06 Thread Hans Aberg
xt in a variable which the lexer reads, and if it is set, emits two ">" in two successive calls. > On 6 February 2013 10:14, Hans Aberg wrote: >> On 6 Feb 2013, at 00:54, Adam Smalin wrote: >> >>> This doesn't help :( I see >> is in the lexer

Re: Solving >> issue in templates

2013-02-06 Thread Hans Aberg
ously > would suffer from it. Have you tried the other way around: sorting out ">>" in the actions? But otherwise, there might be somebody out there already having solved this. > On Mon, Jan 28, 2013 at 6:16 PM, Hans Aberg wrote: > On 15 Jan 2013, at 03:48, Adam Sm

Re: Solving >> issue in templates

2013-01-28 Thread Hans Aberg
On 15 Jan 2013, at 03:48, Adam Smalin wrote: > As we know in C++ there is a issue... You might inquiry in the Usenet newsgroup comp.compilers. There is a Yaccable C++ grammar for an older revision, it may not have been updated. http://www.parashift.com/c++-faq-lite/yaccable-grammar.html Hans

Re: Parsing multiple files with same parser

2012-11-17 Thread Hans Aberg
On 17 Nov 2012, at 23:48, Tadej Borovšak wrote: > ... now I'm getting an error when trying to run > my parser for the second time using the same file as input [1]. ... > /* Open input stream etc. */ > yyparse (); > /* Close input stream and reopen it */ > /* Flush flex buffer using YY_FLUSH_BUFFER

Re: Compiling Reverse Polish Calculator Example

2012-11-01 Thread Hans Aberg
On 1 Nov 2012, at 18:34, Akim Demaille wrote: > Hi Hans, > > Le 31 oct. 2012 à 15:47, Hans Aberg a écrit : > >> It is pointless in UTF-8, and accepting it encourages a number of other >> problems. >> https://en.wikipedia.org/wiki/Byte_order_mark > > You ar

Re: Compiling Reverse Polish Calculator Example

2012-11-01 Thread Hans Aberg
On 1 Nov 2012, at 18:34, Akim Demaille wrote: > Hi Hans, Hi Akim, > Le 31 oct. 2012 à 15:47, Hans Aberg a écrit : > >> It is pointless in UTF-8, and accepting it encourages a number of other >> problems. >> https://en.wikipedia.org/wiki/Byte_order_mark > >

Re: Compiling Reverse Polish Calculator Example

2012-10-31 Thread Hans Aberg
On 31 Oct 2012, at 09:32, Akim Demaille wrote: > Le 29 oct. 2012 à 18:22, Akim Demaille a écrit : > >> [Paul, this is about quotearg] >> >> Hi Marc, >> >> This message is not related directly to your complaint >> (Hans explained well your issue). This message is about >> Bison not issuing the

Re: Bison Java Interface

2012-10-26 Thread Hans Aberg
On 27 Oct 2012, at 00:07, Marc Mendiola wrote: > To whom it may concern, > > I am currently new to GNU Bison and thus, have only read the manual briefly. > I want to use the Java Interface to implement my parser. I have two > questions. > > (1) I am using a Macbook with GNU Bison version 2.

Re: Compiling Reverse Polish Calculator Example

2012-10-26 Thread Hans Aberg
.7: invalid character: `*' > rpcalc.y:1.8: invalid character: `' > rpcalc.y:1.9: invalid character: `' > rpcalc.y:1.9: syntax error, unexpected identifier > > Do you have any idea why these may be coming up? > > Best, > > Marc > > On Oct 26, 2012,

Re: Compiling Reverse Polish Calculator Example

2012-10-26 Thread Hans Aberg
On 26 Oct 2012, at 23:13, Marc Mendiola wrote: > However, when I try to generate the parser using "bison rpcalc.y," I receive > the following errors. > > rpcalc.y:1.1: invalid character: `\377' > rpcalc.y:1.2: invalid character: `\376' This may be a BOM added by the editor. Try removing it. H

Re: Stack Info or subparsing?

2012-10-11 Thread Hans Aberg
On 11 Oct 2012, at 15:20, Adam Smalin wrote: > Lets say I want to do something like this > > @Start Blah > int a,b > void func() { >beep() > } > float c > @end > > Then I will use Blah in place of declaring all that. Kind of like a C > define. Now here is the twist > > @Start Blah > int a,b

Re: Changing the lookahead token

2012-09-17 Thread Hans Aberg
On 17 Sep 2012, at 15:41, David Kastrup wrote: > Hans Aberg writes: > >> Have you considered the GLR parser? If the correct parse depends on a >> future lookahead, it will split and join when the correct parse is >> used. > > But the correct parse does not depend

Re: Changing the lookahead token

2012-09-17 Thread Hans Aberg
On 17 Sep 2012, at 11:15, David Kastrup wrote: > Hans Aberg writes: > >> Hi David! >> >> On 16 Sep 2012, at 10:51, David Kastrup wrote: >> >>> But that's just guessing. Are there any hard or soft criteria about >>> when it may or ma

Re: Changing the lookahead token

2012-09-17 Thread Hans Aberg
Hi David! On 16 Sep 2012, at 10:51, David Kastrup wrote: > But that's just guessing. Are there any hard or soft criteria about > when it may or may not be allowed to pull the lookahead token out from > under Bison and put something else there? You might look at the push parser, which allows one

Re: Exception safety of generated C++ parser

2012-09-13 Thread Hans Aberg
On 13 Sep 2012, at 22:52, Oleksii Taran wrote: > 13.09.12 19:32, Hans Aberg wrote: >> On 13 Sep 2012, at 17:54, Oleksii Taran wrote: >> >>> Does Bison guarantees exception safety in C++ parser, i.e. will it make >>> any clean-up and free memory if an exception

Re: Exception safety of generated C++ parser

2012-09-13 Thread Hans Aberg
On 13 Sep 2012, at 17:54, Oleksii Taran wrote: > Does Bison guarantees exception safety in C++ parser, i.e. will it make > any clean-up and free memory if an exception is thrown on rule action? Yes, the default stack is std::deque. > I > know about %destructor directive, but it seems irrelevant,

Re: How can I plug-in my own memory management in Bison?

2012-08-22 Thread Hans Aberg
On 13 Aug 2012, at 16:02, Ashish Mahamuni wrote: > I have got my own "my_malloc" and "my_free" methods. > I would like Bison to invoke those for memory allocation and to free the > memory. > > Basically, something similar to lex, where I can specify noyyalloc, > noyyfree and provide my own defini

Re: Bison deterministic LALR parser for C++ (kind of complex langauge) without 'lexar hack' support

2012-08-18 Thread Hans Aberg
On 18 Aug 2012, at 22:39, John Levine wrote: >>> You mean, Fortran is not parseable by Bison, is that what you mean? >> >> Not practical. > > I've written Fortran 77 parsers in yacc. It's quite easy. > > The lexical structure of Fortran is dreadful, but once you understand > the hacks required

Re: Bison deterministic LALR parser for C++ (kind of complex langauge) without 'lexar hack' support

2012-08-18 Thread Hans Aberg
[Please keep the cc to the list, is that others can follow the issue.] On 18 Aug 2012, at 11:15, A D wrote: > You mean, Fortran is not parseable by Bison, is that what you mean? Not practical. Hans ___ help-bison@gnu.org https://lists.gnu.org/mailm

Re: Bison deterministic LALR parser for C++ (kind of complex langauge) without 'lexar hack' support

2012-08-18 Thread Hans Aberg
One can parse a more general language, and cut it down in the actions, but it may not be practically feasible. For example, Fortran, not really, I am told. Hans On 18 Aug 2012, at 11:02, A D wrote: > The reason i posted it here is I was wondering if I would get anywhere with > bison/yacc base

Re: Bison deterministic LALR parser for C++ (kind of complex langauge) without 'lexar hack' support

2012-08-17 Thread Hans Aberg
This is a list for help with with Bison, so you may not get any replies here. Your description is rather vague, and rather than describing a problem, you present your solution. If it is a known language, there are good reasons somebody else has made hacks for that. It seems that you have alread

Re: Bison deterministic LALR parser for C++ (kind of complex langauge) without 'lexar hack' support

2012-08-17 Thread Hans Aberg
On 17 Aug 2012, at 07:47, A D wrote: > I need to write a parser for a programming langauge which is as complex as > C++, and to even complicate the matter, there are constructs in this > langauge that doesn't allow me to use type/identifier dis-ambiguating lexer > hack. In other words, I will have

Re: How can I use namespaces with the C++ interface ?

2012-06-28 Thread Hans Aberg
On 28 Jun 2012, at 14:55, Timothy Madden wrote: > On 06/28/2012 12:38 PM, Hans Aberg wrote: >> On 22 Jun 2012, at 19:42, Timothy Madden wrote: >> >>> How could I use a namespace like yy (the same way bison does) for the >>> generated scanner with the C++ int

Re: How to read an understand the bison report file ?

2012-06-27 Thread Hans Aberg
On 27 Jun 2012, at 13:26, Timothy Madden wrote: >> Either you need to completely change the way you handle the >> spaces/comments, or you have to use GLR, as Hans suggested. > > I would hate to find that I have to push all whitespace/comments into the > content (semantic value) of the lexer toke

Re: How to read an understand the bison report file ?

2012-06-27 Thread Hans Aberg
On 27 Jun 2012, at 13:18, Timothy Madden wrote: >>> I wrote a grammar file for an approximation of the php language (with the >>> purpose of adding braces to single-statements under if, for, while, but >>> that is not included yet), that simply outputs the found tokens back to an >>> output str

Re: How to read an understand the bison report file ?

2012-06-26 Thread Hans Aberg
On 26 Jun 2012, at 13:23, Timothy Madden wrote: > I wrote a grammar file for an approximation of the php language (with the > purpose of adding braces to single-statements under if, for, while, but that > is not included yet), that simply outputs the found tokens back to an output > stream. If

Re: header file guards conflict

2012-05-21 Thread Hans Aberg
On 21 May 2012, at 18:34, Akim Demaille wrote: > Le 21 mai 2012 à 18:27, Hans Aberg a écrit : > >> On 21 May 2012, at 18:17, Akim Demaille wrote: >> >>> Le 21 mai 2012 à 17:55, Hans Aberg a écrit : >>> >>>> Is there any reason to not put all

Re: header file guards conflict

2012-05-21 Thread Hans Aberg
On 21 May 2012, at 18:17, Akim Demaille wrote: > Le 21 mai 2012 à 17:55, Hans Aberg a écrit : > >> Is there any reason to not put all stuff that is public in the parser >> header? This would eliminate the need for any additional header files. > > That's the pl

Re: header file guards conflict

2012-05-21 Thread Hans Aberg
On 21 May 2012, at 16:02, Akim Demaille wrote: > Le 21 mai 2012 à 15:41, Hans Aberg a écrit : > >> On 21 May 2012, at 11:34, Akim Demaille wrote: >> >>>> Is there a better way to do it? >>> >>> This is indeed a problem. I'm sure what the b

Re: header file guards conflict

2012-05-21 Thread Hans Aberg
On 21 May 2012, at 11:34, Akim Demaille wrote: >> Is there a better way to do it? > > This is indeed a problem. I'm sure what the best way to > address this is. In addition, in some cases, creating the > files location.hh, stack.hh etc. is more troublesome than > useful. Perhaps add infixes 'l

Fwd: Error during bison1.35 building

2012-03-26 Thread Hans Aberg
Forwarded messages; replies please cc Victor. Victor: do you have M4 installed? Hans Begin forwarded message: > From: Victor Wilden > Subject: Re: Error during bison1.35 building > Date: 26 March 2012 08:52:57 GMT+02:00 > To: haber...@telia.com > > Hello Hans, > > I saw the bison error thre

Re: Parse Tree using Bison

2012-01-14 Thread Hans Aberg
On 14 Jan 2012, at 11:28, Luca wrote: >>> The bison manual has some good basic examples if i recall. >> ... >>> Read on here >>> http://www.gnu.org/software/bison/manual/html_node/Infix-Calc.html#Infix-Calc >> The C++ example is good, too. It shows how to generate error messages. >> http://www.gnu

Re: Includes

2012-01-13 Thread Hans Aberg
On 13 Jan 2012, at 16:03, Csaba Raduly wrote: > Bison 2.3 used to write the prologue into the definitions file (the header) > > Bison 2.4 seems to have changed this and now writes the prologue into > the parser implementation file. This has created a problem for me > because the %union contains p

Re: Parse Tree using Bison

2012-01-11 Thread Hans Aberg
On 11 Jan 2012, at 01:54, Philip Herron wrote: > The bison manual has some good basic examples if i recall. ... > Read on here > http://www.gnu.org/software/bison/manual/html_node/Infix-Calc.html#Infix-Calc The C++ example is good, too. It shows how to generate error messages. http://www.gnu.org/

Re: Parse Tree using Bison

2012-01-10 Thread Hans Aberg
On 10 Jan 2012, at 01:38, UJWAL POTLURI wrote: > I am new to Bison. I am able to parse the grammar using Bison but I am > unable to figure out how to generate the parse tree. I would be grateful if > anyone could help me out in this. You'll have to build it in the grammar actions. Hans _

Re: regrading the paraser

2011-10-16 Thread Hans Aberg
On 15 Oct 2011, at 19:30, Vinaykumar Shivakumar wrote: > Can we build simple parser for the simple programbecause i didn't know > much about bison > and even i don't have time to learn also > so can you help me to guide regrading this One way start is by the examples in the Bison manual, and

Re: Error during bison1.35 building

2011-10-13 Thread Hans Aberg
On 13 Oct 2011, at 14:45, Tatiana Lazareva wrote: > Thank you, Hans!!! You are welcome. Hans ___ help-bison@gnu.org https://lists.gnu.org/mailman/listinfo/help-bison

Re: Error during bison1.35 building

2011-10-13 Thread Hans Aberg
[PLease cc the Help-Bison list, so others can follow the issue.] On 13 Oct 2011, at 13:14, Tatiana Lazareva wrote: > Thank you, Hans! > I found BISON package of 1.35 version and 2.5 version for my platform and > both of them were successfully installed. > Could your please clear what is M4? Do I

Re: Error during bison1.35 building

2011-10-13 Thread Hans Aberg
On 13 Oct 2011, at 12:03, Tatiana wrote: > I try to build bison-1.35 on sparc Solaris 10. ... > How can I resolve this problem? Try latest Bison 2.5 and make sure to have M4 as well, because it is used to process the skeleton files. Hans ___ help-b

Re: Parse and validate a comma separated list of strings

2011-09-09 Thread Hans Aberg
On 8 Sep 2011, at 05:04, Matt Friedman wrote: > My goal is to parse a comma separated list and validate the values > that I find therein. I don't have a problem parsing the list. This is > fairly straightforward. > > What I would like to do in addition to parsing the list is to validate > that ea

Re: performing actions after parsing

2011-09-07 Thread Hans Aberg
On 5 Sep 2011, at 04:22, Andrew Hume wrote: > bison supports performing stuff before parsing via the %initial-action > directive. > is there a corresponding hook for performing stuff after parsing? > > to me, this is a more necessary hook, as you can do the initial-action stuff > via the grammar

Re: javascript_grammar_ecmascript_transform_unicode_problem

2011-08-25 Thread Hans Aberg
On 25 Aug 2011, at 03:13, Giannis St wrote: > I would like to create a parser for javascript(certainly a subset of > it). I tried to transform ecmascriptA3g(for antlr3) in order to use it > in bison but i had some issues with some unicode characters. > > Does Bison support unicode chars? As

Re: cannot open file xxx/bison-2.4/share/bison/m4sugar/m4sugar.m4

2011-08-24 Thread Hans Aberg
On 24 Aug 2011, at 15:21, Sieburgh,Wouter wrote: > If I cannot move it, it means that I will not be able to build bison (in > various versions) and then give those installations to my customers (as a > convenience), unless they copy it in exactly the same path as I built it, am > I right? Thou

Re: Stopping as soon as a valid symbol is read

2011-07-25 Thread Hans Aberg
On 25 Jul 2011, at 16:22, Ludovic Courtès wrote: > However, with a pure API, I don’t see how to get yyresult back from user > code? The code snippet in the manual pushes tokens but never asks for > the result. Typically one adds the value as an extra argument, as a reference in C++ or pointer i

Re: Stopping as soon as a valid symbol is read

2011-07-25 Thread Hans Aberg
On 25 Jul 2011, at 16:22, Ludovic Courtès wrote: >>> I’m trying to parse a C expression from an input stream. I’d like the >>> parser to stop as soon as a valid expression is read (or an error is >>> encountered). >>> >>> However, the default behavior is to stop whenever a valid expression >>> /

Re: Stopping as soon as a valid symbol is read

2011-07-25 Thread Hans Aberg
On 25 Jul 2011, at 10:52, Ludovic Courtès wrote: > I’m trying to parse a C expression from an input stream. I’d like the > parser to stop as soon as a valid expression is read (or an error is > encountered). > > However, the default behavior is to stop whenever a valid expression > /followed by

Re: How to ignore a token if it doesn't fit in with a rule?

2011-07-23 Thread Hans Aberg
tive would lead to an enormous number of shift/reduce conflicts > (which all would be resolved by shifting), but you'll likely regret > this as you are bound to miss a shift/reduce conflict that you need to > resolve. > > On 23 July 2011 12:43, Hans Aberg wrote: >> On 23 J

Re: How to ignore a token if it doesn't fit in with a rule?

2011-07-23 Thread Hans Aberg
On 23 Jul 2011, at 02:40, uclacasey wrote: > I'm writing a program that handles comments as well as a few other things. If > a comment is in a specific place, then my program does something. > > Flex passes a token upon finding a comment, and Bison then looks to see if > that token fits into a pa

Re: destruct object when is popped from bison stack?

2011-06-20 Thread Hans Aberg
On 19 Jun 2011, at 12:38, Jakub M wrote: > I allocate a new object for each token, and i would like to delete the > object when the token is not used anymore. Is there any directive that > would run the delete code every time a token is popped from the stack? > I thought %destructor is the one, bu

Re: Extra code in y.tab.h

2011-06-08 Thread Hans Aberg
On 8 Jun 2011, at 23:38, Panayiotis Karabassis wrote: >> You can put code in various locations; see the %code directive, sec. 3.7.14. >> You might even tweak the skeleton file to define more code places, but then >> you may have to patch when the original is changed with new Bison releases. > >

Re: Extra code in y.tab.h

2011-06-08 Thread Hans Aberg
[Please keep the cc to the Bison Help list, so that others can follow the issue.] On 8 Jun 2011, at 21:48, Panayiotis Karabassis wrote: >>> What is the recommended way to get extra declarations in y.tab.h (in my >>> case Parser.h) for a C++ parser? >> >> Have you checked the Bison manual, sec.

Re: bison and C++ exceptions

2011-05-26 Thread Hans Aberg
[Please keep the cc to the help-bison list, so others know.] On 26 May 2011, at 13:03, John P. Hartmann wrote: > Well, I did forget, but in this case maybe we do not confuse the children. > > At one point bison picked up a bug in one of the M4 macros. It was > not easy to spot, and it took a wh

Re: bison and C++ exceptions

2011-05-26 Thread Hans Aberg
[Please keep the cc to the help-bison list, so others know.] On 26 May 2011, at 11:16, John P. Hartmann wrote: > The M4 manual by itself is of little use, as all macros are redefined. It says how to redefine them, so advanced users that need to know how it work, should consult it. It is otherw

Re: bison and C++ exceptions

2011-05-26 Thread Hans Aberg
On 26 May 2011, at 07:35, Sergey Klimkin wrote: > I guess it might be helpful, I can not claim yet : ) > there is %initial-action declaration and the %final-action may help, > but rhs symbols will not be discarded. > > %initial-action > { > try { > } > > %final-action > { >} >catch (std:

Re: bison and C++ exceptions

2011-05-25 Thread Hans Aberg
On 24 May 2011, at 20:32, Sergey Klimkin wrote: > Trying to find information about C++ exceptions in semantic actions, with no > results. > Is there any Bison %Decl which allows to move parse stack outside yyparse(), > to destroy a stack values after an exception was thrown within semantic > actio

Re: Extra code in y.tab.h

2011-05-25 Thread Hans Aberg
On 23 May 2011, at 09:40, Panayiotis Karabassis wrote: > What is the recommended way to get extra declarations in y.tab.h (in my > case Parser.h) for a C++ parser? Have you checked the Bison manual, sec. 10.1.6 A Complete C++ Example? One can put it into a new header and include the header. Ha

Re: Selective Compilation

2011-02-08 Thread Hans Aberg
On 8 Feb 2011, at 13:24, Akim Demaille wrote: >>> If I understand your question correctly, here is a way to have multiple >>> scanners and parsers in the same program. >> >> No, he's asking about using a subset of an existing grammar in a new parser. >> >> Example: I have a language which includ

Re: should we deprecate %token-table?

2011-01-09 Thread Hans Aberg
On 9 Jan 2011, at 20:28, Paul Eggert wrote: we document %token-table and yytname as deprecated features and make Bison warn when %token-table is specified This seems the better course to me. The feature does not sound that well-thought-out; if nobody has the time to think it through and do it

Re: parenthesis warnings

2010-12-24 Thread Hans Aberg
On 24 Dec 2010, at 12:54, Akim Demaille wrote: ... I would rather work on finishing glr.cc. I may have an application for this, the functional language parser in the folder in the link below, for the binding of the binding arrow. Also, perhaps you missed that I asked for the state of the C

Re: parenthesis warnings

2010-12-17 Thread Hans Aberg
[CC the list so others get to know the state of the matter.] You are welcome. On 17 Dec 2010, at 17:08, Gergely Feldhoffer wrote: Thank you, we upgraded bison from latest debian 2.4.1 to 2.4.3, and it works just fine. Gergely Feldhoffer On Fri, December 10, 2010 11:24, Hans Aberg wrote

Re: parenthesis warnings

2010-12-10 Thread Hans Aberg
On 8 Dec 2010, at 15:26, Gergely Feldhoffer wrote: ... The recent version of GCC produce warnings like position.hh: In function ‘bool example::operator==(const example::position&, const example::position&)’: position.hh:136:69: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparenthe

Re: ly: combine your lex and yacc specs into one file

2010-11-08 Thread Hans Aberg
On 8 Nov 2010, at 05:43, Jack Andrews wrote: thought this may interest some: http://www.ivorykite.com/ly.html The .ly file name extension is since long used by LilyPond, so you might use something else, say .sly or .yl, which do not have entries in WikiPedia. There are parser generator

Re: Flex or bison?

2010-09-18 Thread Hans Aberg
On 18 Sep 2010, at 09:15, Hans Lodder wrote: I am currently performing a Seach Engine Optimization (SEO) of HTML web-pages of my web-site (on Win XP Home SP3). In order to do that it is important to know, which 3 words are used most frequently on the page. So I wrote a cross referencer (in

  1   2   3   4   5   6   7   >