Re: Problem finding cause of memory exhausted

2008-05-13 Thread Frans Englich
On Tuesday 13 May 2008 11:20:16 Hans Aberg wrote: > On 13 May 2008, at 10:53, Frans Englich wrote: > > yyoverflow is undefined. Even undefined it to be sure. > > The file yacc.c has a segment looking like: >#ifdef yyoverflow > yyoverflow (YY_("memory exhausted

Re: Problem finding cause of memory exhausted

2008-05-13 Thread Frans Englich
On Tuesday 13 May 2008 10:46:05 Hans Aberg wrote: > On 8 May 2008, at 16:46, Frans Englich wrote: > > I'm running into "memory exhausted"... > > > > How should I approach this problem? > > The C stack can be both static (or user defined) and dynamic. This

Re: Problem finding cause of memory exhausted

2008-05-13 Thread Frans Englich
On Saturday 10 May 2008 21:00:50 Laurence Finston wrote: > On Thu, 8 May 2008, Frans Englich wrote: > > I'm running into "memory exhausted" and from reading section 2.3 this is > > apparently caused by doing right recursion instead of left recursion. My > > gra

Problem finding cause of memory exhausted

2008-05-08 Thread Frans Englich
Hi, I'm running into "memory exhausted" and from reading section 2.3 this is apparently caused by doing right recursion instead of left recursion. My grammar is fairly large(grammar file is 3400 lines) and I simply have trouble finding where I do right recursion. How should I approach this pr

Customizing display of tokens(%print?)

2007-06-01 Thread Frans Englich
Hello, When Bison prints error messages for symbols, it doesn't take into account possible semantic values. For instance, it says "unexpected , expected foo". What would be much more helpful is if it printed the semantic values instead. For instance, "123" instead of "" and "myVariable" inste

Re: Grammar failing single lookahead

2007-05-30 Thread Frans Englich
On Wednesday 30 May 2007 12:55, Tim Van Holder wrote: > Frans Englich wrote: > > The intent of the grammar is to enforce that declarations appear in a > > certain order(FirstProlog, SecondProlog), that the declarations are > > optional, and they take the form of "

Grammar failing single lookahead

2007-05-30 Thread Frans Englich
See attached grammar. Its essence is this: - %token DECLARE %token FOO %token BAR Root: Prolog Prolog: FirstProlog SecondProlog FirstProlog: /* empty */ | FirstProlog A SecondProlog: /* empty */ | SecondProlog B A: DECLARE FOO B: DECLARE BAR --

Re: C++, %glr-parser and non-POD semantic values

2007-05-29 Thread Frans Englich
On Tuesday 29 May 2007 12:02, Tim Van Holder wrote: > Frans Englich wrote: > > Hello, > > > > What direction do you recommend me to take? > > > > I like the C skeleton because it's simple and it doesn't have > > dependencies on the STL, which is a n

C++, %glr-parser and non-POD semantic values

2007-05-29 Thread Frans Englich
Hello, I'm switching a parser to be GLR in order to simplify the lexer. It's all in C++, the parser & tokenizer must be exceptions safe(hence, Bison destructors cannot be used to free values, as far as I know), and it must be reentrant. My current parser does not use the C++ skeleton despite b

Re: %glr-parser & %pure-parser

2007-05-29 Thread Frans Englich
On Saturday 26 May 2007 21:13, Joel E. Denny wrote: > On Fri, 25 May 2007, Frans Englich wrote: > > adds %glr-parser under %pure-parser, two things happens beyond changing > > the parser algorithm: > > > > * It copies all the code in the c++ section into the header. &g

%glr-parser & %pure-parser

2007-05-25 Thread Frans Englich
Hello, If I to the following Bison grammar: %{ void dummy(); %} %pure-parser %% Root: /* empty*/ { } %% adds %glr-parser under %pure-parser, two things happens beyond changing t

Delaying activation of actions

2007-02-13 Thread Frans Englich
Hello all, I have a design problem that I don't know how to solve, so any pointer would be highly appreciated! The problem is that is that in a parser for pseudo-XML, I need to delay the lookup of certain names, to after all namespace declarations has been parsed. Here's an example: http://e

Re: Using %printer

2006-09-15 Thread Frans Englich
On Friday 15 September 2006 08:43, Akim Demaille wrote: > >>> "Frans" == Frans Englich <[EMAIL PROTECTED]> writes: > > > > I guess one would have to invent a different "print system" for > > that. Perhaps those "error printers"

Re: Using %printer

2006-09-15 Thread Frans Englich
On Thursday 14 September 2006 12:34, Akim Demaille wrote: > >>> "Frans" == Frans Englich <[EMAIL PROTECTED]> writes: > > > > I'm sure that's practical, but it surely would be cool to be able > > to craft better messages! > > I agree,

Re: Using %printer

2006-09-14 Thread Frans Englich
On Thursday 14 September 2006 09:09, Akim Demaille wrote: > >>> "Frans" == Frans Englich <[EMAIL PROTECTED]> writes: > > > > What exactly does it do, it allows one to at runtime customize the > > message Bison uses for a token(and perhaps even term

Using %printer

2006-09-11 Thread Frans Englich
The Bison manual for 2.3 use %printer but doesn't describe it. How does on use %printer? Will it change much in 2.4? What exactly does it do, it allows one to at runtime customize the message Bison uses for a token(and perhaps even terminal?)? For example, that instead of that Bison says "Une

Wishlist: Allow %defines to specify filename, just like --defines=

2006-08-21 Thread Frans Englich
Hello, I have a wishlist for Bison: It would be practical if the %defines directive allows the filename to be explicitly specified, just like for --defines. For example, --defines=MyFile.h works, but something like: %defines=MyFile.h does not. Being able to do the latter would be practical.

Re: Renaming parser file

2006-08-20 Thread Frans Englich
On Monday 31 July 2006 16:19, Joel E. Denny wrote: > On Mon, 31 Jul 2006, Frans Englich wrote: > > Yeah, still don't see how it would be possible to call the output files > > QueryTransformer.cpp/QueryTransformer.h. Specifying -o > > QueryTransformer.

Re: Renaming parser file

2006-07-31 Thread Frans Englich
On Sunday 30 July 2006 16:30, Joel E. Denny wrote: > On Sat, 29 Jul 2006, Frans Englich wrote: > > The sed calls remove the defines for the YYTOKENTYPE so I can use the > > enum without trouble.(yytokentype). > > This is fixed in CVS, so you should see it in Bison 2.4. Nice

Re: Renaming parser file

2006-07-29 Thread Frans Englich
On Saturday 29 July 2006 22:52, Satya wrote: > > Can I do these renames with bison directives? I would prefer if my .ypp > > file > > was completely self contained and that I didn't have to do any > > post-processing. > > > > There is %file-prefix, but I don't see how it helps me since I don't want

Renaming parser file

2006-07-29 Thread Frans Englich
Hello all, As can be seen, I do a fair bit of post processing on my parser: parser: cd $(srcdir) bison QueryTransformParser.ypp mv QueryTransformParser.tab.cpp QueryTransformParser.cpp mv QueryTransformParser.tab.hpp QueryTransformParser.h sed -i -e 's/#d

%token QUOTE "\""

2006-07-21 Thread Frans Englich
Have a look at these two tokens: %token QUOTE"\"" %token APOS "'" When QUOTE is printed it literally prints: \". It hasn't "un-escaped" when printing, although enough for parsing the grammar at compile time. What is the proper way

Re: default action in yydestruct

2006-07-12 Thread Frans Englich
On Wednesday 21 June 2006 20:20, Joel E. Denny wrote: > On Wed, 21 Jun 2006, Z Liu wrote: > > Is it possible to add a default action to yydestruct? > > Not yet, but we've just been discussing adding this as well as destructors > by semantic type. I make no promises, but I believe it'll be possible

Re: Enum for token '0', EOF

2006-07-08 Thread Frans Englich
On Wednesday 28 June 2006 15:01, Frans Englich wrote: > I am using a hand-written tokenizer unfortunately(would be more practical > to use Flex), and is using yytokentype in order to increase type safety of > the code. > > A problem arrives when I need to return EOF, the '0&#x

Enum for token '0', EOF

2006-06-28 Thread Frans Englich
I am using a hand-written tokenizer unfortunately(would be more practical to use Flex), and is using yytokentype in order to increase type safety of the code. A problem arrives when I need to return EOF, the '0' token. It requires me to engage in static_cast'ing 0 to yytokentype, which is ugly

Re: Retrieving the string name of token

2006-03-07 Thread Frans Englich
On Tuesday 07 March 2006 06:22, Hans Aberg wrote: > On 7 Mar 2006, at 04:02, Frans Englich wrote: [...] > > Please keep one topic per post, with descriptive subject for each. I know.. fully agreed. I have just this experience that if I post several mails I get accused for "

Handling "undeclared" references

2006-03-07 Thread Frans Englich
Hi everyone, I have a parsing problem which I don't know how to solve the best way. In short, it is that I need to parse XML.[1] The problem's essence is shown in this example: The problem is that "xmlns:prefix" declares the prefix 'prefix', but it is used before it is declared. It's used i

Retrieving the string name of token

2006-03-07 Thread Frans Englich
Let's say I've declared the following token: %token IMPORT_MODULE"import module" Is it somehow possible to in code retrieve "import module" when given the IMPORT_MODULE define/enum? Is there a public function somewhere for that? I want to keep the descriptions centraliz

Performance impact of "redundant" rules

2006-03-07 Thread Frans Englich
Hi everyone, Sometimes I write grammar constructs like this: StringLiteral: STRING_LITERAL and use StringLiteral in subsequent rules, instead of STRING_LITERAL directly. The reason is readability, and to stay consistent with an EBNF specification. I wonder, does this cause a negative performa

Re: Performance impact of "redundant" rules

2006-03-07 Thread Frans Englich
On Monday 06 March 2006 22:14, you wrote: > Frans Englich wrote: > > Sometimes I write grammar constructs like this: > > > > StringLiteral: STRING_LITERAL > > > > and use StringLiteral in subsequent rules, instead of STRING_LITERAL > > directly. The reason

Re: Simplifying a "recursive, zero-or more" - grammar

2006-02-20 Thread Frans Englich
On Monday 20 February 2006 02:11, Joel E. Denny wrote: > On Sun, 19 Feb 2006, Frans Englich wrote: [...] > > In other words, this grammar (intentionally) allows zero or more > > DefaultNAmespaceDecl, Setter or NamespaceDecl in arbitrary order. For > > example: "Setter,

Simplifying a "recursive, zero-or more" - grammar

2006-02-19 Thread Frans Englich
Hi everyone, I'm pondering about how to write something in the cleanest/most efficient way. Yes, I know, it's basic stuff, but neveretheless. Look at this grammar: -- FirstProlog: /* empty */ | FirstPrologPart FirstPrologPart | FirstPrologPart

Re: Possible to change name of enum yytokentype?

2006-02-11 Thread Frans Englich
On Friday 10 February 2006 23:10, Joel E. Denny wrote: > On Fri, 10 Feb 2006, Frans Englich wrote: > > On Friday 10 February 2006 17:13, Frans Englich wrote: > > > Hi all, > > > > > > Is it possible to change the name of the yytokentype enum? In my case

Re: Possible to change name of enum yytokentype?

2006-02-11 Thread Frans Englich
On Saturday 11 February 2006 17:23, Joel E. Denny wrote: > On Sat, 11 Feb 2006, Frans Englich wrote: > > On Friday 10 February 2006 23:10, Joel E. Denny wrote: > > > > Ok, that would certainly be nice. Perhaps an option or switch(named > > tokentypename, perhaps?)

Re: Possible to change name of enum yytokentype?

2006-02-10 Thread Frans Englich
On Friday 10 February 2006 17:13, Frans Englich wrote: > Hi all, > > Is it possible to change the name of the yytokentype enum? In my case, I > would rather have it named TokenType. What is the easiest way of achieving > that? Also, why is the defines provides in addition to the en

Possible to change name of enum yytokentype?

2006-02-10 Thread Frans Englich
Hi all, Is it possible to change the name of the yytokentype enum? In my case, I would rather have it named TokenType. What is the easiest way of achieving that? #ifndef YYTOKENTYPE # define YYTOKENTYPE /* Put the tokens into the symbol table, so that GDB and other debuggers know abou

Re: Leaks from bison 2.0/Flex 2.5

2005-10-03 Thread Frans Englich
On Monday 03 October 2005 13:57, Hans Aberg wrote: > On 3 Oct 2005, at 15:35, Hans Aberg wrote: > > This leak is due to the allocation of a C-string for error > > messages. The leak can be fixed by using std::string instead (which > > I did in the skeleton file I am using). > > > > Bison and Flex a

Leaks from bison 2.0/Flex 2.5

2005-10-01 Thread Frans Englich
Hello, I've managed to get the parser & scanner generated from Bison & Flex to leak -- and not from my own actions. I don't know whether it is caused by me using them in a wrong way, or because Flex and/or Bison contains bugs. Below comments have as background Bison 2.0, Flex 2.5.4, and valgri

Re: %union and shared pointers to AST nodes

2005-09-26 Thread Frans Englich
On Friday 16 September 2005 20:28, Evan Lavelle wrote: > struct yystype { > ... > antlr::RefToken tok; > antlr::RefASTast; > }; > > #define YYSTYPE yystype Yupp, that is an attractive solution from a memory management perspective. However, I have trouble with connecting flex to t

%union and shared pointers to AST nodes

2005-09-16 Thread Frans Englich
Hi, I have a problem involving bison although a solution may not directly mean modifying the bison grammar. Nevertheless, someone might be able to spot a solution. From my actions I call factory functions which returns instances I assign to the actions($$), in order to build an AST tree. I wr

Re: Lexical feedback and lookahead

2005-07-27 Thread Frans Englich
On Tuesday 19 July 2005 15:01, Evan Lavelle wrote: > Thanks Tim. At first sight, this fix should be exactly what I need; > however, in my case, it doesn't work... :( > > The problem is that COBOL has a real keyword - FUNCTION - to 'lock on' > > to. So, in your production: > > xxx > > > > : { recogn

Re: Flex: token value more than what regexp matches

2005-07-08 Thread Frans Englich
Hans, Vincent, Thanks for your suggestions -- it of course solved my problem. Cheers, Frans ___ Help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison

Flex: token value more than what regexp matches

2005-07-07 Thread Frans Englich
Hi, I have the problem that the value of a token appears to be more than what the regexp matches. Here's my (snipped) flex file: %} %option 8bit %option noyywrap %option nounput QName [a-zA-Z-]+:[a-zA-Z-]+ NCName [a-zA-Z-]+ Digit [0-9] %% {NCName}{

Re: Interpreting shift/reduce conflicts from .output file

2005-06-15 Thread Frans Englich
On Sunday 12 June 2005 18:13, Sylvain Schmitz wrote: > Frans Englich wrote: > > state 118 > > > >72 SequenceType: ItemType . > >73 | ItemType . STAR > >74 | ItemType . PLUS > >75 | ItemType . QUESTION_MARK &

Re: "Eating" comments: not with Flex but with Bison

2005-06-15 Thread Frans Englich
On Tuesday 14 June 2005 15:15, Tim Van Holder wrote: > Frans Englich wrote: > > On Tuesday 14 June 2005 11:36, Akim Demaille wrote: > >>>>>"Frans" == Frans Englich <[EMAIL PROTECTED]> writes: > >> > > >> > I would prefer to do thi

Re: "Eating" comments: not with Flex but with Bison

2005-06-14 Thread Frans Englich
On Tuesday 14 June 2005 11:36, Akim Demaille wrote: > >>> "Frans" == Frans Englich <[EMAIL PROTECTED]> writes: > > > > I would prefer to do this at the Bison/Parser level because it is > > convenient: I have access to various information passed

"Eating" comments: not with Flex but with Bison

2005-06-13 Thread Frans Englich
Hello, In some languages there are constructs which are insignificant to the parse tree in the same way as white space (sometimes) is. Comments is one such example. The Flex manual have an example on how to do it at the scanner level. Ã…atterns which matches the comments, but doesn't return to

Modularized parser files covering similar grammars

2005-06-13 Thread Frans Englich
Hello, I have a design dilemma that will become real some time in the future, and consider how large it is, I thought it could be a good idea to take a quick look forward. I am building a Bison parser for a language, or to be precise, multiple languages which all are very similar. I have a "m

Flex/Bison: which version to use?

2005-06-13 Thread Frans Englich
Hello, From a vague memory of fellow developers' experiences, I have the idea that what version of Bison/Flex one use is significant. But perhaps that isn't relevant anymore. For my project, written in C++, I simply downloaded the latest versions(at least at that time); I use Bison 2.0, and F

Interpreting shift/reduce conflicts from .output file

2005-06-12 Thread Frans Englich
Hi, In my grammar I have 2 shift/reduce conflicts. I could find those by staring at my grammar until I find where I introduced it, but I thought I could learn to make use of Bison's nifty debugging -- the output file. At the top of my .output file it says: State 118 conflicts: 2 shift/reduce