help-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problems with an unrecognised Token


From: Luca
Subject: Re: Problems with an unrecognised Token
Date: Sat, 23 Apr 2011 13:20:08 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; it; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9

Il 22/04/2011 23.57, Martin Haug ha scritto:
Hello,
I'm new to Bison and tried to write my first bison Parser.
Unfortunately, the Parser only gives my a Syntaxerror.
It should parse Dates in the Form 'DD.MM.[YY]YY
hh:mm[:ss[.sss]]' (without the '').
I use bison version 2.4.3 and gcc version 4.2.4 under Ubuntu 8.04 or
Fedora 14.
The Output of Bison and my parser file are attached.
I'm not sure what other Information you could need, so please help me
out if you miss something.
Kind regards
icehawk


_______________________________________________
address@hidden https://lists.gnu.org/mailman/listinfo/help-bison
Hallo icehawk,
I quikly read your grammar and I noted you defined three tokens without semantic values (TWONUM, WHITESPACE and THREENUM, i.e. 258,259 and 260) but when your lexer reads a date (datum) it just returns a single 'C' char (zeichen and zeichenold) rather then the right token value, so bison immediately generates a syntax error. I think your lexer is bugged, please check the lexer output, it should returns the right token when the input is a date or a time.

Try to give a look to the following example (Reverse Polish Notation Calculator), taken from bison help:
http://www.gnu.org/software/bison/manual/html_node/RPN-Calc.html
your lexer should be close to this one:
http://www.gnu.org/software/bison/manual/html_node/Rpcalc-Lexer.html#Rpcalc-Lexer

Bye,
Luca


reply via email to

[Prev in Thread] Current Thread [Next in Thread]