Search the web
Sign In
New User? Sign Up
compilers101 · Compilers 101
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Real people. Real stories. See how Yahoo! Groups impacts members worldwide.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Messages 1122 - 1151 of 1320   Oldest  |  < Older  |  Newer >  |  Newest
Messages: Simplify | Expand   (Group by Topic) Author Sort by Date ^
1122
So I've finally started working on my compiler again. Well actually I started from scratch since I wasn't happy with the old codebase - it was far too complex...
Tim Wakeham
deltacentauri
Offline Send Email
Dec 4, 2008
3:48 am
1123
... Hey Tim! Glad to see you getting back into it again. I have my BASIC interpreter working quite well now and just recently went through this. My...
Neil Bradley
cneilbradley
Offline Send Email
Dec 4, 2008
5:51 am
1124
From: compilers101@yahoogroups.com [mailto:compilers101@yahoogroups.com] On Behalf Of Neil Bradley Sent: Thursday, 4 December 2008 3:51 PM To:...
Tim Wakeham
deltacentauri
Offline Send Email
Dec 5, 2008
3:42 am
1125
Hi again guys, Just wanted to update on the progress of my parser since I'm really (read: overly ; ) pleased with myself now lol. I can parse a real program...
Tim Wakeham
deltacentauri
Offline Send Email
Dec 5, 2008
8:25 am
1126
... Good to see you back in the game :-) Can you see if you can work out a way to return a const expression from the normal expression parser, without...
Graham Toal
graham_toal
Offline Send Email
Dec 5, 2008
3:17 pm
1127
The way I was considering doing it was to have an optional argument to the expressions function which was passed down to the level of the terminals and if it's...
Tim Wakeham
deltacentauri
Offline Send Email
Dec 6, 2008
2:55 am
1128
Actually you know, I've changed my mind, I'm not gonna do it the way I was going to because then I would have to do all the reference checking and type ...
Tim Wakeham
deltacentauri
Offline Send Email
Dec 6, 2008
3:23 am
1129
... Yep, you got it. The result of calling the expression parser should be an AST object composed of operator nodes and terminals. If the operators of a node...
Graham Toal
graham_toal
Offline Send Email
Dec 6, 2008
3:40 am
1130
Cool, I've already figured out how I'm going to do expression folding and the object based AST should make it super easy. I've now just realised that I...
Tim Wakeham
deltacentauri
Offline Send Email
Dec 6, 2008
4:04 am
1131
Ok so I've come up with an idea, if an operator node is on the top of the stack when i go to pop off the number on both sides of an operator, then the operator...
Tim Wakeham
deltacentauri
Offline Send Email
Dec 6, 2008
4:55 am
1132
... I see, so you're building the ENTIRE tree as one large parse tree and THEN emitting code. You can do that sort of fixup when you do that - I couldn't. You...
Neil Bradley
cneilbradley
Offline Send Email
Dec 6, 2008
5:56 am
1133
... That's a really good idea, Tim. I wound up having an "EvalConst()" procedure and an "ExprEmit()" procedure, both of which pretty much do the same thing,...
Neil Bradley
cneilbradley
Offline Send Email
Dec 6, 2008
5:57 am
1134
... It depends upon what your right side operators do. Normally things like post increment/decrement: a = variable++; Is really just shorthand for: a =...
Neil Bradley
cneilbradley
Offline Send Email
Dec 6, 2008
6:05 am
1135
... The most generic way I can think of is to handle these in the grammar rather than the lexer, ie anywhere you currently have <term>, replace it with...
Graham Toal
graham_toal
Offline Send Email
Dec 6, 2008
9:20 am
1136
From: compilers101@yahoogroups.com [mailto:compilers101@yahoogroups.com] On Behalf Of Graham Toal Sent: Saturday, 6 December 2008 7:20 PM To:...
Tim Wakeham
deltacentauri
Offline Send Email
Dec 6, 2008
10:09 am
1137
It actually just occurred to me that there are really only two practical post fix operators anyway, and they are increment and decrement, which don't have a...
Tim Wakeham
deltacentauri
Offline Send Email
Dec 6, 2008
10:16 am
1138
... Unless you've been extremely foresightful in your language design, it is almost certain you'll need some lookahead - or more likely backtracking - in your...
Graham Toal
graham_toal
Offline Send Email
Dec 7, 2008
3:17 am
1139
Turns out the solution was a lot easier than I though and it doesn't require lookahead or backtracking in the parser. As you suggested, the parser does ...
Tim Wakeham
deltacentauri
Offline Send Email
Dec 7, 2008
5:41 am
1140
... In that case you _were_ extremely foresightful in your language design! (Or lucky :-) ) I have a deadline at work in a few weeks time and probably won't...
Graham Toal
graham_toal
Offline Send Email
Dec 7, 2008
5:40 pm
1141
I thought I'd share a profound moment I just had - I'm coding my parser with all the features of the language I want regardless of whether I know how to...
Tim Wakeham
deltacentauri
Offline Send Email
Dec 8, 2008
11:01 am
1142
... Isn't it always so much more satisfying when you discover something like this for yourself :-) We actually discussed this type of parser some time ago -...
Graham Toal
graham_toal
Offline Send Email
Dec 8, 2008
4:32 pm
1143
PS This statement needs to be re-examined. You need to handle whitespace some way or other, and it's not that difficult. ... I think the problem you may be...
Graham Toal
graham_toal
Offline Send Email
Dec 8, 2008
4:36 pm
1144
Yup I remember talking about and coding a precedence parser for expressions, but I don't remember taking it further than that - I'll have to go have a look at...
Tim Wakeham
deltacentauri
Offline Send Email
Dec 8, 2008
9:25 pm
1145
I do handle it, I just don't parse it; it's fully removed by the lexer. What I really wanted in my language was to have no braces and have whitespace determine...
Tim Wakeham
deltacentauri
Offline Send Email
Dec 8, 2008
9:30 pm
1146
Oh something else I meant to ask- Should the parser just turn everything into a syntax tree regardless of whether it's semantically correct or not? The problem...
Tim Wakeham
deltacentauri
Offline Send Email
Dec 8, 2008
10:10 pm
1147
... Sometimes it is easier to allow the grammar to accept more than it should, and eliminate some bad combinations after it has been parsed. This can simplify...
Graham Toal
graham_toal
Offline Send Email
Dec 8, 2008
10:16 pm
1148
I actually think it will be cleaner to do it this way rather than dirty which is why I asked, but yeh I was referring to the philosophical side of things From:...
Tim Wakeham
deltacentauri
Offline Send Email
Dec 8, 2008
11:50 pm
1149
... If you perceive the problems to be inherent, then perhaps you are trying to do it the wrong way. If you try to shoehorn a traditional generic bottom up...
Rainer Thonnes
rainer@...
Send Email
Dec 9, 2008
2:01 pm
1150
Ok I have many questions after I sat on my hands for a day and thought about my compiler rather than coded, so here goes hopefully some can be answered - 1....
Tim Wakeham
deltacentauri
Offline Send Email
Dec 11, 2008
6:52 am
1151
... It's possible to do it. I can't recall where I saw it, but I think it had to do with the preamble of the procedure when called. There was some sort of...
Neil Bradley
cneilbradley
Offline Send Email
Dec 11, 2008
6:59 am
Messages 1122 - 1151 of 1320   Oldest  |  < Older  |  Newer >  |  Newest
Advanced
Add to My Yahoo!      XML What's This?

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help