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
_______________________________________________
[email protected] 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
_______________________________________________
[email protected] https://lists.gnu.org/mailman/listinfo/help-bison