4 ms·
For the record, I think it's a terrible idea to keep prototyping compilers in C in this day and age. There is already a DSL for compiler construction and it's c
by mahmud 17y ago
For the record, I think it's a terrible idea to keep prototyping compilers in C in this day and age. There is already a DSL for compiler construction and it's called Standard ML. SML/NJ, along with the New Jersey Machine Toolkit, Ramsey and Fernandez' excellent binary-frobbing-utility framework (yes! tools that generate profilers, debuggers, tracers, assemblers and disassemblers!) along with stuff from the SUIF project, you can start writing very sophisticated industrial compilers in fraction of the time it takes to debug just the front-end stuff in C. Even Perl, or your scripting language of choice, is better than C for compiler hacking.
http://suif.stanford.edu/papers/ http://suif.stanford.edu/papers/
http://www.cs.tufts.edu/~nr/toolkit/ http://www.cs.tufts.edu/~nr/toolkit/ (devour Norman Ramsey's site and read his joint papers with Mary Fernandez; him, along with Monica Lam at Stanford, the Rice people Linda Torczon, Keith Kooper et al. are producing some of the most accessible tools and papers and certainly most exciting. The Rice group is also responsible for the best introductory compiler hacking text in recent publication: Engineering a Compiler. GET IT! If even just for the carefully curated bibliography.
Also, recently, the ACM PLDI published a list of 20 most influential papers in programming languages design and implementation:
http://www.cs.utexas.edu/users/mckinley/20-years.html http://www.cs.utexas.edu/users/mckinley/20-years.html
I took the time to scrape as many of them as I could off of the internet, wherever they were freely available (i.e. author's websites) and I can say I have 18 of them. I would love to share them with hungry minds in one tarball, or they can google the papers individually:
A Data Locality Optimizing Algorithm.pdf
A Safe Approximate Algorithm for Interprocedural Pointer
Aliasing.pdf
An Evaluation of Staged Run-Time Optimizations in DyC.pdf
An Implementation of Lazy Code Motion for SUIF.pdf
Analysis of Pointers and Structures.pdf
Balanced Scheduling- Instruction Scheduling When Memory Latency is Uncertain.pdf
Complete Removal of Redundant Expressions.pdf
Global Register Allocation at Link Time.pdf
How To Read Floating Point Numbers Accurately.pdf
Improving Register Allocation for Subscripted Variables.pdf
Interprocedural Constant Propagation.pdf
Interprocedural Slicing Using Dependence Graphs.pdf
Lazy Code Motion.pdf
On-The-Fly Detection of Access Anomalies.pdf
Register Windows vs. Register Allocation.pdf
Soft Typing.pdf
Software Pipelining-- An Effective Scheduling Technique for VLIW Machines.pdf
The Design and Implementation of a Certifying Compiler.pdf
- ilyak 17y agoWell, you can write your own guideline on how to prototype a language in SML, post it to NH, and profit. Now we don't see your guideline but do see Flex/Bison/LLVM one.
- jrockway 17y ago"Let's intentionally do things wrong because nobody posted details about the right way to HN." Yeah, go for it...
- ilyak 17y agoHow would one do things right if there are no examples of comparable quality? Revisit the recent drama with twisted vs tornado.
- mahmud 17y agoHow would one do things right if there are no examples of comparable quality? By researching independently when given sufficient pointers. I posted a link to Abdul Azziz Ghoulum's paper which shows a full compiler in small baby steps, bootstrapped from the first line! Research and conference papers are fairly good for learning, almost as good as blog posts.
- calambrac 17y agoWTF is wrong with you? That was one of the most informative comments I've ever seen on this site. There was a ton of useful information in there, way more than the short little guide in the OP (which I'm not knocking at all).
- ilyak 17y agoI'd like it to be a stand-alone article. This way it would be a first-class citizen on HN. I mean, more meat, examples, and soon quite a few more people know how to prototype a language in SML.