... The page above is slightly updated, and I've used that algorithm in a real(ish) program: http://www.gtoal.com/athome/utils/xpp.c.html It's worth having a...
551
Rick Clark
rickclark58
May 13, 2005 4:03 pm
... Heh, it just shows that some things never go out of style. Thanks for the example. Rick Clark Discover Yahoo! Find restaurants, movies, travel and more fun...
552
Ed Davis
ed_davis2
Jun 4, 2005 5:26 pm
I'm trying to figure out which is the best way to parse the following simple grammar, using a hand-written parser: stmtseq = {stmt} stmt = "if" expr "then"...
553
Rainer Thonnes
rainer@...
Jun 5, 2005 10:25 pm
... The closing square bracket is in the wrong place, isn't it? ... The grammar is incomplete and glosses over the existence of "normal" simple statements,...
554
Ed Davis
ed_davis2
Jun 6, 2005 7:30 pm
... Sorry about that. It should be: stmt = "if" expr "then" stmtseq ["else" stmtseq] "endif" ... I did mean "not". The loop should continue while one of...
555
Rainer Thonnes
rainer@...
Jun 6, 2005 8:58 pm
... Hmm. What am I missing here? Is "token" not the same thing as what "is_token" looks at before consuming it? If so, then it seems to me that all the...
556
Adeel Javed
chadeeljaved
Jun 10, 2005 9:56 am
Hello All, I designed a new object oriented programming language named "Awal" as part of my MS Computer Sciences thesis. Now I want to develop a fully working...
557
Ed Davis
ed_davis2
Jun 18, 2005 1:44 pm
I'm trying to figure out how to generate quads. I can generate p-code while parsing, or generate an AST and generate p-code from that, but I have not figured...
558
Graham Toal
graham_toal
Jun 18, 2005 6:30 pm
... There is *very little* to do actually. Your AST is almost exactly in the right format; you just have to output each AST entry in the right order. for each...
559
Ed Davis
ed_davis2
Jun 18, 2005 9:46 pm
... Wow - it turned out to be so easy. I've looked at your example many times, but for some reason it never clicked. However, something you said in the above...
560
Graham Toal
graham_toal
Jun 18, 2005 11:48 pm
... A brief aside from the subject... what you describe above is what happens so often in programming, at least to me - I can read all the books, look at...
561
Graham Toal
graham_toal
Jun 19, 2005 12:25 pm
... In the else part, you need explicit tests for left and/or right also being leaf nodes. If they are, don't gen_expr - just use the name... so... ... will...
562
Ed Davis
ed_davis2
Jun 21, 2005 1:36 am
... I can definitely relate. Mine was Wirth's Pascal-s. It seemed like such a mystery until only just a few years ago. ... Nope! ... Me too. Thanks again for...
563
M. Uli Kusterer
witness_of_t...
Jun 23, 2005 6:40 pm
... Just thought I'd thank everyone who answered to this question I posed. I went through all of your answers. There were lots of great VMs there, but they all...
564
M. Uli Kusterer
witness_of_t...
Jun 23, 2005 6:46 pm
Hi, I used to hand-grow all my parsers, and a while ago thought I'd give Flex/Yacc a try again. I actually got it to wonderfully lex and parse my language, but...
565
Olivier Galibert
galibert@...
Jun 23, 2005 6:55 pm
... You have to define yyval as a union. I hand-grow by lexers so there may be a specific typename to use, but in any case here is the start of one of my...
566
Mauro Persano
mauro_persano
Jun 23, 2005 6:56 pm
Hello, ... Here is something I wrote a while ago: http://fuse.superglue.se/mcc_i386.tar.gz It's a compiler for a small subset of C. I don't think you can call...
567
Olivier Galibert
galibert@...
Jun 23, 2005 6:59 pm
... They're not using flex/bison anymore but hand-made recursive parsers instead... OG....
568
M. Uli Kusterer
witness_of_t...
Jun 23, 2005 7:50 pm
... Thanks, that filled in some of the blanks. Somehow I completely overlooked %type in favor of %token, which caused part of my problem. Your example showed...
569
M. Uli Kusterer
witness_of_t...
Jun 23, 2005 7:50 pm
... AFAIK that's a new development, though. I remember reading somewhere (gnustep-discuss?) that this new parser was checked in only recently. But I think the...
570
M. Uli Kusterer
witness_of_t...
Jun 23, 2005 7:51 pm
... It was actual, practical code, that's exactly what I had hoped for. Yes, it's a little larger than I'd have needed, but it demonstrated that I was on the...
571
Ed Davis
ed_davis2
Jun 23, 2005 8:13 pm
... See this page: http://epaperpress.com/lexandyacc/ He has a simple calculator like language, and compiles to either an AST or to byte-code. ...
572
Daniel K. O.
danielosmari
Jun 24, 2005 4:15 am
... If you are working in C++, there are more interesting ways to work, like Boost.Spirit (http://www.boost.org/libs/spirit/index.html) - but you need to be a...
573
Chris Cranford
chrisc062677
Sep 16, 2005 9:50 pm
Just curious if there was still anyone out there. Chris [Non-text portions of this message have been removed]...
574
chris.cranford@...
chrisc062677
Sep 17, 2005 12:17 am
If I define two regular-expression rules such as: "if" { return TT_IF; } [a-zA-Z]([a-zA-Z]|[0-9] { return TT_IDENTIFIER; } Then in my code I have something...
575
Graham Toal
graham_toal
Sep 17, 2005 5:34 am
... Assuming this is a general question and not specific to yacc/lex ... there are two ways of combining lexers and parsers. The yacc/lex model is that you...
576
Graham Toal
graham_toal
Sep 17, 2005 6:15 am
... The Edinburgh Computer History Project has quite a few versions of the same basic parser as it was developed over the years, but this is about the earliest...
577
Uli Kusterer
witness_of_t...
Sep 17, 2005 9:12 am
... Not sure what lexer you're using, but FLex always returns the longest possible match. Cheers, -- M. Uli Kusterer http://www.zathras.de...
578
Graham Toal
graham_toal
Sep 17, 2005 3:18 pm
... Yep :-) By the way, found this today: http://easynews.dl.sourceforge.net/sourceforge/inger/CompilerConstruction.pdf 246 page book on writing a compiler for...
579
chris.cranford@...
chrisc062677
Sep 17, 2005 8:16 pm
I actually ran across a PDF on oolex yesterday and found that their approach made sense to me. What it described was the concept that each lexer rule is in a...