Re: Windows Internationalization

2008-07-11 Thread Tim Van Holder
Luca wrote: Hello! I have written a compiler for a pascal-like language, using flex and bison. The compiler is built under Windows using Visual Studio and works very well, however how can I provide an internationalization? I need to translate syntax error messages generated by bison's parser in

Re: AW: AW: Segmentation Fault in yyparse() method

2007-11-16 Thread Tim Van Holder
Jonas Stahl wrote: >> Try running the application under valgrind or some other memory debugger. >> If possible also try slightly different releases of gcc (4.1.1 or 4.2); >> there's an outside chance that it's a bug in gcc. > > Thanks. I think this isolated the fault a bit more. > I tried debuggin

Re: AW: Segmentation Fault in yyparse() method

2007-11-15 Thread Tim Van Holder
Jonas Stahl wrote: > In the version with segmentation fault (gcc 4.1.2): > > 33117 if (yychar == YYEMPTY) > (gdb) > 33120 yychar = YYLEX; > (gdb) > > Program received signal SIGSEGV, Segmentation fault. > yyparse () at fullParser.tab.c:33120 > 33120 yychar = YYLEX; > > > I

Re: Segmentation Fault in yyparse() method

2007-11-14 Thread Tim Van Holder
Jonas Stahl wrote: > Hi, > > I'm a german student (so sorry for my bad english). > > I'm working at my bachelor thesis and I'm having a little problem with > Bison/Flex. > [snip] > Does Anybody have a good hint for me? Well, is the use of bison/flex required? My initial reaction when I saw the c

Re: GLR ambiguity

2007-06-14 Thread Tim Van Holder
Alessandro Di Marco wrote: > Hi all. > > It seems that both the options above are valid, so they need > disambiguation. I've tried '%dprec' (as also suggested in bison manual), but > without any success. > > For your convenience I have stripped down the grammar to the below few lines, > which produ

Re: Grammar failing single lookahead

2007-05-30 Thread Tim Van Holder
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 "declare ". > > This is something that naturally leads to a shift/reduce conflict. As far as >

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

2007-05-29 Thread Tim Van Holder
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 no go for me, unfortunately. So, I simply need a > parser(GLR, or non GLR, if necessary) that can have non-POD se

Re: Google summer of code '07

2007-03-24 Thread Tim Van Holder
Fangzhou Jiao wrote: > 2007/3/24, Satya <[EMAIL PROTECTED]>: >> Hello! >> I am looking at implementing the XML *. output in Bison this summer. >> The one thing I did not understand on the project ideas page >> (http://www.gnu.org/software/soc-projects/ideas.html) is >> >> " Define an XML grammar fo

Re: How to make Bison disregard tokens?

2007-03-02 Thread Tim Van Holder
Edsko de Vries wrote: > if(...) > { > blah > // TODO: must do something else here > } > > f(); > > the comment is not associated with the call to f, but with a NOP > instruction which is the last instruction in the body of the if. That I would expect a } to be a token, so the comment

Re: How to make Bison disregard tokens?

2007-03-02 Thread Tim Van Holder
Edsko de Vries wrote: > On Fri, Mar 02, 2007 at 12:55:29PM +0100, [EMAIL PROTECTED] wrote: >> On Friday 02 March 2007 12:30, Edsko de Vries wrote: >>> Hi, >>> >>> Is there any way I can make Bison ignore tokens when it can't deal with >>> them? I'll try to explain. For every completely blank line i

Re: Memory Allocation in Bison

2007-02-06 Thread Tim Van Holder
Martin Bock wrote: > Hi everybody, > > > I have have a question concerning memory allocation for yyval in bison: > I' looking for the memory reserved for yyval, how it is done and how > much it is. In the .c-file generated by bison, I found yyval is of the > type YYSTYPE. But I cannot find any in

Re: Token redefinition

2006-11-17 Thread Tim Van Holder
Bob Smith wrote: > The language uses token as "INT" "BOOL" or "FALSE"; when I compile the > project using > Visual Studio 6.0 the following message is displayed: > > "'BOOL' : redefinition; typedef cannot be overloaded with any other > symbol" > > How about #undef BOOL, etc

Re: Token redefinition

2006-11-17 Thread Tim Van Holder
Hans Aberg wrote: > On 16 Nov 2006, at 11:41, Giampaolo Fadel wrote: > >> I need to write a simple compiler for a pascal-like linguage, using >> flex and bison. >> The language uses token as "INT" "BOOL" or "FALSE"; when I compile the >> project using >> Visual Studio 6.0 the following message is

Re: bison and malloc

2006-10-11 Thread Tim Van Holder
s88 wrote: > On 10/11/06, Tim Van Holder <[EMAIL PROTECTED]> wrote: >> >> s88 wrote: >> > Hi all: >> > I'm confused with the bison and malloc right now... >> > I'm using the Bison 2.0 on Ubuntu(Linux) 6.06, and everytime when I use >&

Re: bison and malloc

2006-10-11 Thread Tim Van Holder
s88 wrote: > Hi all: > I'm confused with the bison and malloc right now... > I'm using the Bison 2.0 on Ubuntu(Linux) 6.06, and everytime when I use > the malloc(actually is strdup) in the production rules. It will cause an > unpredictable > segmentation fault. The stack size on my system is set

Re: Odd parser behaviour

2006-09-25 Thread Tim Van Holder
Heiko Wundram wrote: > Am Montag, 25. September 2006 10:34 schrieb Tim Van Holder: >> If seeing a portion of the actual grammar where I encountered the >> behaviour would be clearer, let me know and I'll post it. > > Sure, please post that. I consider the topic more or

Re: Odd parser behaviour

2006-09-25 Thread Tim Van Holder
Heiko Wundram wrote: > Am Montag, 25. September 2006 08:49 schrieben Sie: >> >> >> Except that it actually takes the entire "opt_C opt_D E" path - if an A >> is seen, it will reduce opt_C and opt_D then error out on the "E" rule, >> while it should have reduced up to the "bar" nterm, and only try

Re: Odd parser behaviour

2006-09-24 Thread Tim Van Holder
Heiko Wundram wrote: > Am Freitag, 22. September 2006 15:26 schrieb Tim Van Holder: >> I would expect this to accept any input starting with A(B|C?D?E)+, >> but in practice, it only accepts input starting with A(B|CDE)+, >> because for the xyzzy nterm, it always trie

Odd parser behaviour

2006-09-24 Thread Tim Van Holder
Given a simple grammar %token A B C D E F %% foo : bar { YYACCEPT; } ; bar : A plus_xyzzy ; plus_xyzzy : xyzzy | plus_xyzzy xyzzy ; xyzzy : B | opt_C opt_D E ; opt_C : | C ; opt_D : | D ; %% I would expect this to accept any input starting with A(B|C?D?E)+, but in practice, it only accept

Re: Using %printer

2006-09-15 Thread Tim Van Holder
Akim Demaille wrote: "Frans" == Frans Englich <[EMAIL PROTECTED]> writes: > > Opening the source and printing it is surely a good idea and a very nice > > complement to regular reporting, but I still think that improving regular > > reporting is significant. > > I was not proposing to re

Re: better error reporting with bison and flex

2006-06-22 Thread Tim Van Holder
Guillaume Rousse wrote: > Which is really not meaningful for user :/ I'd prefer to at least > display current line, and avoid refering to internal grammar symbols. Part 2 - not referring to internal grammar symbols: use string aliases for your tokens, like so: %token MY_IDENTIFIER "identifier" %

Re: Boolean sets

2005-12-20 Thread Tim Van Holder
Nicholas Crosbie wrote: > I would like to set a a Bison project which processes > a an expresssion of the form > > gate = r3 AND r5 NOT (r5 OR r7) > > i.e. a Boolean expression of arbitrary > length/complexity, where r3, r5 etc. are > variables containing integer data (e.g. an array, or > stored

Re: Calling two times yyparse reloading yyin

2005-11-30 Thread Tim Van Holder
Ismael Moreno wrote: > First of all, i've included an "old" version of this piece of code. I fixed > after ask the yyin field, so sorry. > > Well, after using yyrestart and all what you said, now looks like the > problem is in the first yyparse() function. > > I made an diagram with an "assigment

Re: Calling two times yyparse reloading yyin

2005-11-29 Thread Tim Van Holder
Ismael Moreno wrote: > void cAssigNode::translate(cVM& vm) throw(std::exception) > { > char* Text; > Text = strdup(RValue.c_str()); > > FILE* yyin = fmemopen(Text, strlen(Text), "r"); > if(yyin == NULL) > throw(cError("Can't open yyin stream")); > > yyparse(); yypars

Re: Accessing data structures in grammar

2005-11-24 Thread Tim Van Holder
Leon Mergen wrote: > g++ -c -g -O0 asm_parser.cpp > asm_parser.y: In member function `virtual int yy::Parser::parse()': > asm_parser.y:84: error: request for member `char_t' in `(this + >44)->yy::Stack::operator[] [with T = yystype, S = > std::dequestd::allocator >](0)', which is of non-cla

Re: Cookie replacement function

2005-11-08 Thread Tim Van Holder
Jonathan Selander wrote: > Hi, I'm trying to do a very trivial thing using flex/bison. I want to > make a sort of cookie replacement function, that finds a pattern in a > string and replaces it with something else. > > The string to look for is in the format "%{text}" and later on perhaps > "%{tex

Re: Leaks from bison 2.0/Flex 2.5

2005-10-02 Thread Tim Van Holder
Frans Englich wrote: > 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 B

Re: Bison 2.1 released

2005-09-20 Thread Tim Van Holder
Paul Eggert wrote: > Bison version 2.1 has been released. It would be nice if you added a step - freeze messages and submit pot files to the TP one week before release to the Bison release procedure (or alternatively, make 'submit .pot file to the TP' part of the alpha release procedure). I

Re: Lexical feedback and lookahead

2005-07-19 Thread Tim Van Holder
Evan Lavelle wrote: > I've got a problem where I need some communication back from Bison to > Flex (in this case, I need Flex to return two different tokens for the > same input, depending on context). > > The procedure is something like: > > 1 - parser determines context and sets global flag for

Re: %union, C++, symbol types

2005-07-07 Thread Tim Van Holder
Evan Lavelle wrote: > I'd like to pass a token class from Flex to Bison (ideally, a > tr1::shared_ptr - a reference counted smart pointer class). However, in > Bison itself I need to deal with a number of symbol types - tokens, AST > nodes, and so on. > > This means that I need to use a %union, bu

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

2005-06-14 Thread Tim Van Holder
Frans Englich wrote: > 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 to the >> > parse funct