help-bison
[Top][All Lists]
Advanced

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

Re: Bison Help needed


From: Luca
Subject: Re: Bison Help needed
Date: Sun, 01 Aug 2010 11:55:54 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; it; rv:1.9.1.11) Gecko/20100711 Thunderbird/3.0.6

Il 28/07/2010 23.38, Arnabendu Roy ha scritto:
Hi Team,

Could you please help me.  I am new to Bison,  As per the documentation, I
have created the rpcalc.y and generated a parser file with the help of
Bison.  Now,  Can I use Visual C++
to generate the object code.
yes
I am not sure if Visual C++ (Visual Studio
2008) is ISO C89 or later.  When I try to compile the parser file, I get 55
errors.
It should compile. Try to compile the code as C++ code (change the file extension to .cpp or change compiler settings)
I know I must be doing something wrong but not sure what.  Can you please
provide the steps to compile this parser file in Visual C++. Ihave windows
XP.
In the attachment you'll find a Visual Studio 08 solution to create a simple C parser based on the following C grammar:
http://www.lysator.liu.se/c/ANSI-C-grammar-y.html
it checks the syntax of test.c. Inside the zip you'll find also a batch (rename it form .eee to .bat to bypass gmail checks) to run bison and flex from cygwin distribution.

I think this is a good starting point:
http://epaperpress.com/lexandyacc/download/lexyacc.pdf

Also this link could be useful for you, if you love to use Visual Studio:
http://msdn.microsoft.com/en-us/library/aa730877%28VS.80%29.aspx
You can download the rules from:
http://www.microsoft.com/downloads/details.aspx?FamilyId=36873774-CA5B-4B49-ACB7-94B8CD4EF502&displaylang=en


As a general rules using bison:

  1. Install flex and bison from cygwin (or download from
     http://gnuwin32.sourceforge.net/packages.html)
  2. Open MS Visual Studio and create *Win32 Console Application project.*
  3. Open Project/ Project Property Pages/Configuration
     properties/C/C++/Precompiled Headers and chose *Not Using
     Precompiled Headers*.
  4.   In Project Defaults chose *Use Multi-Byte Character Set*
  5. Add in "additional include directory" unistd.h, provided with bison


Bye,
Luca
Thanks and Regards!

Arnabendu Roy
_______________________________________________
address@hidden http://lists.gnu.org/mailman/listinfo/help-bison


Attachment: CParser.zip
Description: Zip compressed data


reply via email to

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