Hello, I hope everyone's doing well -- summer started for me last week and I've certainly been enjoying it :) I haven't worked on my compiler stuff since the...
I have a question about hand-written scanners. I have noticed a difference in the scanners found in Wirth's books (Algorithms+Data Structures=Programs,...
... I don't think it matters much. When looking at the bigger picture (ie., the whole lexer and all of the symbol types it has to recognize), which one ...
... IIRC, gcc either reads the whole file or mmaps it depending on its size. It was the optimal way on most systems at the time. The end result is the same...
Olivier Galibert
galibert@...
Jun 19, 2003 6:31 am
219
... A few notes: In many implementations, getc is a macro, so calling it has very little overhead. Additionally, FILE streams are buffered, so very little disk...
... The EMAS compilers from the 70's used memory-mapped files, which is equivalent to reading the whole file into a buffer. That feature reappeared with the...
... I don't think that's the case nowadays. GCC doesn't implement it as a macro nor does MSVC. ... That's true. The overhead of buffered input does become...
Here is another try at a simple scanner, for the simple language noted below. This version loads the entire file before scanning, and uses macros to access...
... You're right. I was sure that most C compilers implemented getc/fgetc as macros, but the last time I looked was around 1985 or so (when I was learning C),...
... As others have already indicated, it makes no real difference, in principle, whether you read the whole file into memory (or map it into virtual memory)...
Rainer Thonnes
rainer@...
Jun 19, 2003 6:44 pm
225
... Isn't it also the case that there is no universally promulgated standard? I mean, whereas every C implementation worth its salt implements all the usual...
Rainer Thonnes
rainer@...
Jun 19, 2003 8:48 pm
226
... I'd guess that file input was a little less complex and could be implemented with macros back then. You're right about the buffering and if anything, it's...
... A stack of lists? Actually, more like a stack of stacks. Well, since a stack is typically implemented as a list anyway, the distinction may seem a little...
Rainer Thonnes
rainer@...
Jun 20, 2003 2:22 pm
228
How would one parse a pascal-like super "in" operator: Where the "in" could be used for not only integers, but any basic data type (integers, reals, strings): ...
... It certainly does. ... How do you treat comparators, i.e. the likes of "==" and ">=" and "<"? Are they just ordinary binary operators handled by your...
Rainer Thonnes
rainer@...
Jun 20, 2003 10:52 pm
230
... I don't have any comments on parsing this but if you are doing pascal-like set extensions in your language, you may find this helpful in actually...
... Sure. I may not have translated from my dialect of BNF notation to yours correctly. In yours, it seems, curly brackets denote indefinite repetition (zero...
Rainer Thonnes
rainer@...
Jun 24, 2003 9:30 pm
234
... Definitely! Thanks for sharing this. I recently upgraded to Win2K and I completely forgot to backup my bookmarks ... lost. ... Bart...
Here's a compiler worth a look if you haven't seen it before: http://fabrice.bellard.free.fr/tcc/ http://fabrice.bellard.free.fr/tcc/tcc-doc.html Small and...
One of my favorites: ftp://ftp.cs.chalmers.se/pub/users/augustss/oc.tar.gz From the read.me: This is an implementation of a small subset of C. Do `make test'...
... Cool! From the same site, I was also impressed by his original 'tiny-c': http://fabrice.bellard.free.fr/otcc/otccelfn.c Pretty impressive, if not a little...
Hey Bart, it's been a long time... what are you up to nowadays? I have a suggestion if you are still planning to write a small C compiler, which is something...
... Damn Eudora Light's message filtering!! It looked like Graham's message was in my inbox rather than my Compilers101 mailbox. Ah, well :P ... Bart...
... I have been working on automatically generated code generators for multiple target machines. I have a system called ILCG ( Intermediate Language for Code...
Paul Cockshott
wpc@...
Sep 2, 2003 10:47 am
243
Hello, I dug out my Small C compiler project I started at the beginning of this year and have written a grammar for declarations. Unfortunately, the DDJ Small...
... Yes, that last one is valid as well. ... Actually, signed/unsigned and int/char can come in any order. You can have: int unsigned x; char signed x; And if...
I'm trying to determine which is the better format to use for an AST - a binary tree, a n-node tree, but with a fixed number of nodes, or a multi-way tree,...