Re: Expression grammar with call

2013-11-29 Thread Philip Herron
actually i think i am getting confused i will make a test case to show it. On 29 November 2013 11:54, Philip Herron wrote: > hmm not sure should i use this: does it mean i should use flex to look at > the next token if it '('. > > Since it looks like IDENTIFIER '(

Re: Expression grammar with call

2013-11-29 Thread Philip Herron
; %token IDENTIFIER INTEGER CALL > %% > > expression: IDENTIFIER '=' expression > | expression '+' expression > | '( ' expression ')' > | primary > > primary: IDENTIFIER >

Expression grammar with call

2013-11-29 Thread Philip Herron
Hey all, Its been a while since i've really seriously been working with bison but say i have the grammar: %right '=' %left '+' expression: IDENTIFIER '=' expression | expression '+' expression | ... | '( ' expression ')' | primary

Re: Regarding Compiler Construction using Bison

2013-07-06 Thread Philip Herron
This is a bigger question in how do i make a compiler using bison. It depends on what you want to do i assume you want to output traditional assembler but if your asking this generic question you should probably do some more reading around the subject. To get a jist of what bison offers follow the

Re: Parse Tree using Bison

2012-01-10 Thread Philip Herron
On 11 January 2012 00:39, UJWAL POTLURI wrote: > Can you please show me an example of how to do. > > On Tue, Jan 10, 2012 at 3:52 AM, Hans Aberg wrote: > >> >> On 10 Jan 2012, at 01:38, UJWAL POTLURI wrote: >> >> >     I am new to Bison. I am able to parse the grammar using Bison but I >> am >> >

Re: What do you use bison for?

2011-06-04 Thread Philip Herron
Well i am working on my own gcc front-end and use it to implement python and i also used it for my own interpreter to my own language. Used it for a compiler project at university to implement a basic set of modula. This may be a nice topic on comp.compilers if your really interested. What do you

Re: parenthesis warnings

2010-12-10 Thread Philip Herron
I havent checked the absolute latest gcc svn for about 2 months but yeah those are the new gcc 4.6 warnings this looks like a c++ parser my normal c parsers havent generated any such warnings but i would like to check also when i get a chance. --Phil On 10 December 2010 10:24, Hans Aberg wrote:

Re: help me please

2010-11-08 Thread Philip Herron
On 7 November 2010 08:45, najim shekofteh wrote: > i want to install bison on the win xp > please send for me version of bison for win xp > please > http://gnuwin32.sourceforge.net/packages/bison.htm Google is your friend, Note installing this don't install it to a path with a folder with a space

Re: Grammar problem

2010-10-04 Thread Philip Herron
On 4 October 2010 17:06, Philip Herron wrote: > Hey > > This i am having trouble trying to think what the grammar would look > like. Say i had the language: > > 10 > 1100 > 111000 > > How would i represent that in a grammar? > > I've been thinking somethin

Grammar problem

2010-10-04 Thread Philip Herron
Hey This i am having trouble trying to think what the grammar would look like. Say i had the language: 10 1100 111000 How would i represent that in a grammar? I've been thinking something like: S->0S0 | B B-> lambda | 1B >From one of my old grammars but that generates 010 or 00100 etc.

Re: how to send data up the stack

2010-08-10 Thread Philip Herron
On 10 August 2010 21:23, Sasan Forghani wrote: > Chris, > > The project is for a CS class.  I don't know if I can submit it to the > list.  I don't want my code out on the internet.  I don't know how my prof > would feel about that.  That being said, I discovered that if I add any code > Bison's p

Re: Short hand expression operators

2010-03-24 Thread Philip Herron
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hans Aberg wrote: > Have you tried just adding %token PLUSPLUS "++" .. expr: expr "++" > .. etc. with some %prec, possibly %left, %right? > > Hans > Thanks that works i feel a bit silly when i look at something like my exp "==" exp its a similar idea

Short hand expression operators

2010-03-24 Thread Philip Herron
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hey guys I was just thinking until now in my language i haven't allowed operators like '++' or '+=' etc. Though in the Lex and Yacc book i took the example of using: '-' express %prec UMINUS inline with my usual: exp '+' exp etc, so this allows '-2

Bison Windows m4 problems

2010-03-10 Thread Philip Herron
Hey guys, I am hoping someone has some experience here in using bison in windows. I installed the Gnuwin32 version of Bison since this seems to be the offical windows binaries of Bison as far as my google'ing took me. So in my project i decided to support a mini cmake setup specificly for working

Re: Flex and Bison C++ Example

2010-03-08 Thread Philip Herron
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Robert Hollencamp wrote: > I made an example of using Flex and Bison together in C++ and was > wondering if you guys could provide some feedback. Despite the C++ > interface being 'experimental' I found it works out pretty good > after you figure it ou

Re: how to parse linear equations

2010-01-16 Thread Philip Herron
On 16/01/2010 15:02, Hans Aberg wrote: On 16 Jan 2010, at 15:52, Michael Chen wrote: Exactly, I would like to first process the linear expression, which are coefficients and a constant; how can I do it over my ast tree recursively? + * * 2+ 3 - x

Re: How to learn bison efficiently if I want to generate parse in C++?

2010-01-01 Thread Philip Herron
On 02/01/2010 04:22, John Levine wrote: I want to learn to generate parser in C++. However, the book by Levine only mentioned C++ in the last chapter, Chapter 9. All the examples in Chapter 1-8 are in C. Instead of reading the book in order, could somebody let me know if there is a faster way to

Re: How to get the actual string for a symbol?

2009-12-30 Thread Philip Herron
On 31/12/2009 05:11, Peng Yu wrote: I want to get words from a file and print them out. But I'm not sure how to make yylval a pointer to the string yytext. Could somebody let me know how to modify the following code so that the string can be retrieved the symbol WORD. yylval_string.l

Re: How to construct a BNF for a language mechanically and incrementally?

2009-12-28 Thread Philip Herron
On Mon, 2009-12-28 at 20:54 -0600, Peng Yu wrote: > It seems to me that to use bison I have to have a BNF first. I'm > reading Programming Language Pragmatics 3rd Ed (PLP3). What is not > clear to me is that how to construct the BNF for a language? Based on > my reading of PLP3, I haven't found a f

Re: please help me with this

2009-12-19 Thread Philip Herron
On Fri, 2009-12-18 at 01:58 -0500, Tejas Kajarekar wrote: > Hello, > My name is Tejas. I am trying to use Flex and Bison to parse (and convert) > one file to another format. Currently, I am not bothered about conversion, > just the parsing. > I have never used either tools, and what my problem is,

Re: Question about using Bison

2009-12-08 Thread Philip Herron
You may have good experience using cygwin instead of visual studio but it depends if you have to use visual studio., writing your own makefile or using automake might be a nicer solution. http://www.cygwin.com/. Since from the sounds of it you have to generate your stuff manually before compiling w

Re: $1 of 'whatever' has no declared type

2009-11-22 Thread Philip Herron
Joel E. Denny wrote: On Sat, 21 Nov 2009, brad wrote: I have a Bison grammar that I've been working on for a while now, and I never had this problem until I recently upgraded Ubuntu. Now when I try to run the grammar through Bison I get loads of "$1 of 'whatever' has no declared type" er

Re: I got an error using Bison

2009-11-13 Thread Philip Herron
Hey I am not sure if this will work since i don't have access to windows at home, but i remember some people have good success using cygwin to do this kind of work in, instead of trying to make the single program work with windows which can be painful, due to the reasons you mentioned. http://www

Re: yy_scan_string

2009-10-14 Thread Philip Herron
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 never2di wrote: > I'm a newbie to Bison + Flex. and I'm having trouble in getting > yy_scan_string to work. I have tried the following > > YY_BUFFER_STATE my_string_buffer = yy_scan_string(my_string); > yyparse(); yy_delete_buffer(my_string_buffer ); >

Re: SegFault with Bison Grammar

2009-09-18 Thread Philip Herron
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hey Kyle Kyle Brandt wrote: > Hi Phil, Thank you for the response and time, regarding what you > said: I probably wasn't that helpful ;) > > **GDB** I have tried GDB, my gdb skills are weak trying to learn > how to use it better, but I am still not su

Re: SegFault with Bison Grammar

2009-09-18 Thread Philip Herron
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hey I'm guessing were not going to debug it for you but say, GDB? But some tips are, I take it your using LEX with this? If so say you have a rule like identifier something like [a-zA-Z]+ thats bad rule.. but anyways, make sure you do a string dump of

Re: Why the "compound_statement " is useless no-terminator ???

2009-09-13 Thread Philip Herron
wan sheg wrote: Hi : I'm using bison for a sub-set grammar of C language . But I encounter a difficult . flowing is the core part of my grammar file; /* grammar for subset of C language */ %left OR_OP %left AND_OP %left '+' %left '-' %left '*' %left '/' %% %start file

Re: C parser Can't be Linked to C++ Driver

2009-09-07 Thread Philip Herron
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Evan Carew wrote: > I'm trying something not found in any of the manuals or the > O'Reilly books. I'm trying to create a C lexer and parser (mainly > because C++ isn't really supported all that well yet), then link > them in with my C++ driver routine.

Re: Return from recursive processing is incomplete

2009-09-07 Thread Philip Herron
riptions, if so, then this would > be a good book to try out on-line. > > http://safaribooksonline.com/Corporate/Index/ > > Evan > > Philip Herron wrote: > >> Ah cool never saw that, its hard to find o'reilly here in >> Ireland, i usually just get whatever i

Re: Return from recursive processing is incomplete

2009-09-07 Thread Philip Herron
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Derek M Jones wrote: > Philip, > >> No problem i got a the book LEX and YACC o'reilly: >> http://oreilly.com/catalog/9781565920002/ > > Flex & Bison is now available (17 years more up todate) > http://oreilly.com/catalog/9780596155971/ > Ah cool never

Re: Return from recursive processing is incomplete

2009-09-07 Thread Philip Herron
Evan Carew wrote: Phil, Thanks for the assist. I have a feeling that this will allow me to continue my research with bison. Hey No problem i got a the book LEX and YACC o'reilly: http://oreilly.com/catalog/9781565920002/ It helped me a lot when i was learning these. You only really need t

Re: Return from recursive processing is incomplete

2009-09-06 Thread Philip Herron
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Evan Carew wrote: > I'm working with Bison 2.0 on linux and am having trouble getting > all of the output from a recursive call to a rule. I have input a > piece of C code which represents an enum into a lexer designed for > C and a bison rule set desi

Re: My Flex/Bison process is stalling when trying to read a left bracket.

2009-08-09 Thread Philip Herron
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Philip Herron wrote: > j...@garveydesign.com wrote: >> The processes proceed well until the compiler generated >> encounters an opening bracket. I get the following output... > >> This is the cln file Aug 2 2009 [sudo] pa

Re: My Flex/Bison process is stalling when trying to read a left bracket.

2009-08-09 Thread Philip Herron
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 j...@garveydesign.com wrote: > The processes proceed well until the compiler generated encounters > an opening bracket. I get the following output... > > This is the cln file Aug 2 2009 [sudo] password for joe: removing > lex.yy.c rm: cannot remove `le

Re: I'm getting messages from Bison that aren't even listed on the internet.

2009-08-02 Thread Philip Herron
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hey I think i see the problem, try to split your grammar up more and make more use of the lexer.. read-on j...@garveydesign.com wrote: > Results from Google re Your search - gnu bison "$$ of `constant' > has no declared type" - did not match any docu

Re: can i change a non-terminal type without using %union?

2009-07-21 Thread Philip Herron
Hey As the resons i showed in (1) and (2), I indicate that bison treats non-termimal as integers and it change NUMBER from double to int when it get yylval from flex. Is that right? I know I can using %union to specify the type of non-terminals,can i fix the problem without using the direct

Re: %union problems

2009-05-15 Thread Philip Herron
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hey Varga-Háli Dániel wrote: > I just started to get the grasp of bison and how to make it work with > flex. I have defined a struct in the grammar file similar to this: > > typedef struct { > char *mem1; > char *mem2; > } where_cls; > > The union

Re: Can't compile bison/flex output files without cc?

2009-05-01 Thread Philip Herron
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hey I got this all working it seems. I didn't finish it but i can see how anjuta makes it work. So basicly you want to be just adding in your foo.l and fooparser.y as your sources. Because when you add a new source you should notice anjuta manages yo

Re: Can't compile bison/flex output files without cc?

2009-05-01 Thread Philip Herron
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hey I found this thread: (is it the same problem?) http://ubuntuforums.org/showthread.php?t=834944 I am downloading anjuta to try it out for doing bison/flex so i'll let you know how i get on. But i think there must be a way to do this. If you have

Re: Can't compile bison/flex output files without cc?

2009-05-01 Thread Philip Herron
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hey One quick question what do you mean that you cant use CC in anjuta? as in c-compiler or what? This is the way your don't want to be working with your parser and lexer. I mean you want your makefile to be re-generating your parser and compiling if

Re: Reading parser stack

2009-04-29 Thread Philip Herron
Mike Aubury wrote: > Thats because you've not set up $2 properly.. > > Normally - you'd have something like : > > %type C > > in the top section of your .y file. > along with something like : > > %union { > char str[2000]; > } > > Now - you may be using 'int's et

Re: Multiple Lexer

2009-04-29 Thread Philip Herron
Hans Aberg wrote: > On 15 Apr 2009, at 14:41, Philip Herron wrote: > >> So my problems is i have a program which it would be nice to have 2 >> completely separate lexers only one of them needs a yacc grammar file. > > It seems you have not gotten a reply. > > Set t

Multiple Lexer

2009-04-15 Thread Philip Herron
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hey I have been going through the autoconf/automake mailing lists for this. I thought i had this fixed. So my problems is i have a program which it would be nice to have 2 completely separate lexers only one of them needs a yacc grammar file. So i d