Linked by Thom Holwerda on Wed 7th Nov 2007 10:09 UTC, submitted by Chris Lattner
General Development The LLVM Compiler System is being used for all sorts of interesting things these days. It basically provides an extremely modular and easy to use set of open source (BSD-licensed) compiler libraries that can be used to build various applications from. Despite this, many people don't really understand it, and are scared away by the breadth of the project or by compilers in general. The Kaleidoscope tutorial starts out from scratch and slowly builds up a simple language to show how LLVM can help out with this. We end up with a JIT compiler for a fairly interesting little language with less than 700 lines of code. Of course, this is just the tip of the iceberg, once you start with LLVM, there are all sorts of things you can do.
Thread beginning with comment 283412
To view parent comment, click here.
To read all comments associated with this story, please click here.
RE: Lame tutorial.
by meianoite on Wed 7th Nov 2007 18:09 UTC in reply to "Lame tutorial."
meianoite
Member since:
2006-04-05

Very lame tutorial; the author's proposals do not scale in a real programming language. And he skips perhaps the most important part, i.e. type checking.


Have you ever seen any tutorial that describes every aspect of building a real-life implementation of whatever the tutorial subject is?

Tutorials are simply things that point you to the direction of how things are done under a given environment. It won't give you a step-by-step breakdown on how to write your own operating system, or to build your own your own Gothic cathedral.

The sole purpose of tutorials is to present concepts you're familiar with on ways that match the environment you're working with at the moment. If you need to go beyond that, then you need a "For Dummies" book, then there's a natural progression to books named after the subject, then books named after the subject with an "Advanced Topics" subtitle, then "Subject: the reference manual", then after half a decade or so "Subject: becoming more productive", "Subject: a modern approach", and finally you manage your way around a simple cheat sheet.

See, tutorials are polar opposites of "cheat sheets".

(and yes, it gives me the creeps when I see newbie Python programmers using cheat sheets and coming up with sloppiest solution ever for a given problem, coated with the shiniest syntactic sugar...)



Edit: I'm past the edit time for my previous message, but I just found the link to Dragon Book, 2nd ed. on Amazon, and I think it's worth sharing:
http://www.amazon.com/Compilers-Principles-Techniques-Tools-2nd/dp/...


Edited 2007-11-07 18:16

Reply Parent Bookmark Score: 3

RE[2]: Lame tutorial.
by axilmar on Thu 8th Nov 2007 14:15 in reply to "RE: Lame tutorial."
axilmar Member since:
2006-03-20

No, I have seen tutorials that are small scale but what they show have real value.

If his purpose was only to show LLVM, he would have skipped lexing and parsing and AST and he would have gone straight to how LLVM is used to produce code.

His tutorial can be summarized into the following simple phrases:

step 1: LLVM has a library which contains classes which can be used to represent a program; LLVM knows how to interpret the instances of these classes to assembly code.


step 2: In order to provide optimizations, you tell the compiler engine which optimizations you require and then you call the engine to optimize the objects produced in step 1.

Reply Parent Bookmark Score: 1