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 1159 - 1188 of 1320   Oldest  |  < Older  |  Newer >  |  Newest
Messages: Simplify | Expand   (Group by Topic) Author Sort by Date ^
1159
Understanding and Writing Compilers http://www.cs.mdx.ac.uk/staffpages/r_bornat/books/compiling.pdf When I was a student, you would read the Dragon book to...
Graham Toal
graham_toal
Offline Send Email
Jan 3, 2009
8:26 pm
1160
Here's a guy who wrote a C subset in his spare time for fun: http://nwcc.sourceforge.net/...
Graham Toal
graham_toal
Offline Send Email
Feb 4, 2009
2:57 pm
1161
Hello, I'd like to build a simple compiler. To summarize it, these are the requirements. I'll be adjusting the requirements list as I actually start...
stranger1234@...
stranger1234...
Offline Send Email
Feb 13, 2009
3:57 pm
1162
On Fri, Feb 13, 2009 at 8:13 AM, stranger1234@... ... Welcome! ... There are several ways of interpreting a program; you can compile to an...
Graham Toal
graham_toal
Offline Send Email
Feb 13, 2009
4:09 pm
1163
... I was thinking more like: read the code --> parse it --> make intermediate code --> run it Your approach should improve performance though. I guess we can...
stranger1234@...
stranger1234...
Offline Send Email
Feb 13, 2009
5:17 pm
1164
Just to update the current status. What I've done is a lexical analysis. What is next step that I should do? Is it the syntax analysis? For the following...
stranger1234@...
stranger1234...
Offline Send Email
Feb 13, 2009
7:59 pm
1165
I'd say the first thing is to describe your language with a grammar such as BNF. Then decide what kind of parser you want (and whether you're going to write...
Graham Toal
graham_toal
Offline Send Email
Feb 13, 2009
8:09 pm
1166
... I want to write it from scratch. And as for the grammar, lets define it this way: there are no functions, there is only int, variables, +, -, *, /, postfix...
stranger1234@...
stranger1234...
Offline Send Email
Feb 13, 2009
9:13 pm
1167
On Fri, Feb 13, 2009 at 3:13 PM, stranger1234@... ... No, but it's too complex to expect to code all at once at get right first time. Let's start...
Graham Toal
graham_toal
Offline Send Email
Feb 13, 2009
10:59 pm
1168
... OK, I rearanged my source code to recognize the following: whitespaces (which are ignored in the further processing routines), names (only ASCII letters),...
stranger1234@...
stranger1234...
Offline Send Email
Feb 14, 2009
1:14 pm
1169
Just to update, I've implemented the grammar rules, and my not-yet-a-compiler now parses strings like: int a int a, b int a, b = 2 int a, b = a int a, b = 2, c...
stranger1234@...
stranger1234...
Offline Send Email
Feb 14, 2009
4:38 pm
1170
... That sounds about right. For the 'special signs', with this simple grammar, the only work your lexer has to do is distinguish '++' from '+'. What sort of...
Graham Toal
graham_toal
Offline Send Email
Feb 14, 2009
6:07 pm
1171
... Next step is 'show us your code' :-) Do you parse expressions already? Or just declarations? Once expressions are looking good, yes, probably building the...
Graham Toal
graham_toal
Offline Send Email
Feb 14, 2009
6:10 pm
1172
... For this first round, I'm doing it unoptimized way, just to get the hang of it. For ++ I'm returning string "++" and string "special". Once I complete this...
stranger1234@...
stranger1234...
Offline Send Email
Feb 14, 2009
6:54 pm
1173
... The code has over 200 lines, many of which are simple copied and adjusted. Here is the example: int var(struct token_t *token, int i, int n) { int a, b; ...
stranger1234@...
stranger1234...
Offline Send Email
Feb 14, 2009
7:04 pm
1174
... Let's do the easy one first (coding it in the grammar) and come back to this later. ... Oh yes, that'll work too :-) ... That's to be expected in a...
Graham Toal
graham_toal
Offline Send Email
Feb 15, 2009
5:31 am
1175
... art ... I'll try to do it here. If the browser breaks it all up, I'll create and upload an image. Here is what I'd do for the expression: int a, b = 2, c =...
stranger1234@...
stranger1234...
Offline Send Email
Feb 15, 2009
10:50 am
1176
... Not a problem. actually the declaration tree is a little trickier than the expression tree, because it allows for a list. Let me take a quick side-track...
Graham Toal
graham_toal
Offline Send Email
Feb 15, 2009
7:17 pm
1177
... If by "3rd variable declared" you're referencing to the "variables table" then I know exactly what you're talking about. Aren't the variable type and name...
stranger1234@...
stranger1234...
Offline Send Email
Feb 16, 2009
4:42 pm
1178
... yes, you can throw away the name when you use a variable, though it's useful to keep a pointer to it so you can print it in your debugging info. ... Sure,...
Graham Toal
graham_toal
Offline Send Email
Feb 16, 2009
7:29 pm
1179
... actually there's a design decision needs to be made here, the choice is that in some compilers it is easier to handle declarations as soon as you see them,...
Graham Toal
graham_toal
Offline Send Email
Feb 16, 2009
7:33 pm
1180
... Well, just knowing <VAR, 3> would be enough because if I wanted to know a name (or a type for instance), I'd go and lookup variables table and find all the...
stranger1234@...
stranger1234...
Offline Send Email
Feb 16, 2009
10:22 pm
1181
... One other problem popped my mind. Look at this code as an example (my first compiler will be simple, but I'd like to make my second compiler "more usable")...
stranger1234@...
stranger1234...
Offline Send Email
Feb 16, 2009
10:40 pm
1182
... they ... In my compiler, I forced all variables to be defined before they could be used to simplify my language. Therefore, each declaration of a variable...
CRANFORD, CHRIS
Chris.Cranford@...
Send Email
Feb 17, 2009
2:39 pm
1183
... This is an area you'll eventually have to look at and you might as well tackle it now. The usual approach is to push the most recent declaration of a...
Graham Toal
graham_toal
Offline Send Email
Feb 17, 2009
3:03 pm
1184
... This compiler I'm currently building is likely to adhere to the same idea. But that would not work in the following scenario, would it? int a() { int x =...
stranger1234@...
stranger1234...
Offline Send Email
Feb 17, 2009
7:52 pm
1185
... Would introducing the column scope help? So when saying "x" I'd be actually referencing something like main::x? This first compiler would contain only...
stranger1234@...
stranger1234...
Offline Send Email
Feb 17, 2009
7:58 pm
1186
My whole program broke down after modifying functions so they build the tree. I think it would be the best if I'd rewrite the whole thing again. Is there...
stranger1234@...
stranger1234...
Offline Send Email
Feb 17, 2009
9:10 pm
1187
I'll summarize all of my concerns that I can think of now. How exactly to deal with a+++b? (that should be interpreted as a + ++b) When do I implement the...
stranger1234@...
stranger1234...
Offline Send Email
Feb 17, 2009
9:16 pm
1188
... There are many ways to handle your Symbol Table. I decided to implement mine in a tree structure. I've seen others use other fancy lists, stacks, etc....
CRANFORD, CHRIS
Chris.Cranford@...
Send Email
Feb 17, 2009
10:14 pm
Messages 1159 - 1188 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