Date: Mon, 21 Mar 2005 17:06:20 +0100 From: =?ISO-8859-1?Q?Ra=FAl_Izquierdo_Castanedo?= <raul.izquierdo@gmail.com> To: davidxu@viatech.com.cn, ports@FreeBSD.org Subject: FreeBSD Port: byaccj-1.1 Message-ID: <f2e121f505032108067a20bddf@mail.gmail.com>
next in thread | raw e-mail | index | archive | help
------=_Part_914_3636651.1111421180777 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hello, I'm Ra=FAl, Professor at University of Oviedo (Spain) where I teach Compiler Construction. After using PCLex/Pcyacc during many years I decided to change them and after checking several tools I decided to use byaccJ. I write you because I think something goes wrong when generating the parser in Java (no problem in C++). First of all I assure you that I've tried to solve the problem for myself: - I have checked the samples generating C/C++ with byacc and with other LR tools. All of them where right with the same input grammar except ByaccJ. - I've searched in Google for a solution. Nothing found. =BFCould this be a bug? ------------- 1) The first sample is (I include a ZIP with complete files to run) inicio: expr { System.out.println($1.ival); } ; expr: '+' CTE expr { $$.ival =3D $2.ival + $3.ival; } | {$$.ival =3D 0; } ; When I run it a "Null pointer exception" is throw. When it tries to access the stack to get the semantic values ($n) it seems to get a null pointer from the stack. --------------------- 2) The second sample is: inicio: expr { System.out.println($1.ival); } ; expr: CTE moreTerms { $$.ival =3D $1.ival + $2.ival; } ; moreTerms: '+' CTE moreTerms { $$.ival =3D $2.ival + $3.ival; System.out.println($2 =3D=3D $3); } | { $$.ival =3D 0; } ; I think it's another view of the same bug. Now the program runs without exceptions, but the final result is wrong. There is a problem with the $s. Sometimes $2 and $3 reference the same ParserVal instance (see the System.out.println($2 =3D=3D $3) ). Could you please help me? If I don't find a solution I will have to select another tool and I think it byaccJ is the best. Thanks in advance Ra=FAl Ps: I assure you that this translation from spanish hasn't been made automatically by Google. ;) ------=_Part_914_3636651.1111421180777--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?f2e121f505032108067a20bddf>