8 ms·
LLVM Tutorial
- SparrowOS 14y agoAre you fucken retarded? You think I'm a dime store moron? I had a fucken 1440 SAT! Does one hair more or less make you go to bald, yet there is baldness. "Everyone is a criminal". Go away pathetic retard. ---- 27 “You have heard that it was said, ‘You shall not commit adultery.’[e] 28 But I tell you that anyone who looks at a woman lustfully has already committed adultery with her in his heart. 29 If your right eye causes you to stumble, gouge it out and throw it away. It is better for you to lose one part of your body than for your whole body to be thrown into hell. 30 And if your right hand causes you to stumble, cut it off and throw it away. It is better for you to lose one part of your body than for your whole body to go into hell. Divorce 31 “It has been said, ‘Anyone who divorces his wife must give her a certificate of divorce.’[f] 32 But I tell you that anyone who divorces his wife, except for sexual immorality, makes her the victim of adultery, and anyone who marries a divorced woman commits adultery. Oaths 33 “Again, you have heard that it was said to the people long ago, ‘Do not break your oath, but fulfill to the Lord the vows you have made.’ 34 But I tell you, do not swear an oath at all: either by heaven, for it is God’s throne; 35 or by the earth, for it is his footstool; or by Jerusalem, for it is the city of the Great King. 36 And do not swear by your head, for you cannot make even one hair white or black. 37 All you need to say is simply ‘Yes’ or ‘No’; anything beyond this comes from the evil one.[g] Eye for Eye 38 “You have heard that it was said, ‘Eye for eye, and tooth for tooth.’[h] 39 But I tell you, do not resist an evil person. If anyone slaps you on the right cheek, turn to them the other cheek also. 40 And if anyone wants to sue you and take your shirt, hand over your coat as well. 41 If anyone forces you to go one mile, go with them two miles. 42 Give to the one who asks you, and do not turn away from the one who wants to borrow from you. Love for Enemies 43 “You have heard that it was said, ‘Love your neighbor[i] and hate your enemy.’ 44 But I tell you, love your enemies and pray for those who persecute you, 45 that you may be children of your Father in heaven. He causes his sun to rise on the evil and the good, and sends rain on the righteous and the unrighteous. 46 If you love those who love you, what reward will you get? Are not even the tax collectors doing that? 47 And if you greet only your own people, what are you doing more than others? Do not even pagans do that? 48 Be perfect, therefore, as your heavenly Father is perfect. ---- God says... C:\Text\BIBLE.TXT ate of judgment with cunning work; after the work of the ephod thou shalt make it; of gold, of blue, and of purple, and of scarlet, and of fine twined linen, shalt thou make it. 28:16 Foursquare it shall be being doubled; a span shall be the length thereof, and a span shall be the breadth thereof. 28:17 And thou shalt set in it settings of stones, even four rows of stones: the first row shall be a sardius, a topaz, and a carbuncle: this shall be the first row. 28:18 And the second row shall ----- Jesus hung-out with "drunkards and gluttons." It's in there. --- God's gonna rip you a new hole, you fuck with Him.
- program 14y agoMaking my first toy language is one of the most interesting advertures as a programmer. LLVM is quite complex and the documentation is far from stellar but it's usable for teaching how a compiler works. Also I like the restyling. LLVM landing page is so 90'.
- adamnemecek 14y agoBuilt with HTML tables too!
- mercurial 14y agoLooks like it's done with sphinx, which is wonderful for this sort of thing.
- pjmlp 14y agoOne thing you might find interesting is to generate some kind of bytecode as textual representation. Then write Assembly macros that translate those bytecode into real Assembly code. This will give you a nice picture without much effort how code generation can be done. Surely the performance won't be stellar, but is a nice experience. On the other hand you can plug it directly into LLVM, but there you get more things to learn at the same time, which might slow you down.
- c3d 14y agoSurprising that this topic has (as of now) 60 point and only two comments. At Taodyne, we use LLVM as the foundation for our 3D dynamic document description language. This makes it possible to do interesting things in real-time, see e.g. http://www.taodyne.com/shop/en/blog/58-live-coding-creating-a-3d-dna-strand http://www.taodyne.com/shop/en/blog/58-live-coding-creating-.... LLVM is pretty powerful, and now relatively stable as far as even the C++ API is concerned. In earlier days, having the C++ API change underneath you in significant way at every release was a real pain. That being said, I was not a real fan of their documentation in general, and the Kaleidoscope tutorial was no exception. But it looks like they are putting a lot of effort into this, and it looks much much better than it used to.
- confluence 14y agoHN is one of those great communities where people usually don't comment when they they aren't qualified to comment. It's either that, or they get down voted to heck and hell banned if they continuously post low quality material. It's probably more of the latter :) The one problem I have with HN is the basic/extreme bike-shedding situation we have here. Articles on hiring, firing, culture, etc. (softer - more bs subjects) and the singularity, complex economics and quantum physics (softer - more bs subjects for laymen) seem to get a metric ton of crappy comments from people who aren't qualified to talk about said topics and HNers seem to be much too nice (or don't care) enough to point out the crap for what it is. I try to avoid those types of posts nowadays.
- nikk44 14y agoThe one problem I have with HN is imbeciles like you.
- confluence 14y agoBitch please. If you want to insult me for no particular reason - at least have the balls to swear at me with your real account. Trollers gonna troll.
- SparrowOS 14y agoI think video games are sick, and stupid. I used to like them... I guess. What you find in the world is eveybody wants to limit other's freedoms in some areas but don't like their own freedoms being limited. Bet you didn't care about beating up mental health people, but video games limitations are a problem! You could be mental and on welfare faster than a snap. God says... C:\Text\WEALTH.TXT of the earth, the precious metals and the precious stones, should gradually come to be more and more in demand, should gradually exchange for a greater and a greater quantity of food; or, in other words, should gradually become dearer and dearer. This, accordingly, has been the case with most of these things upon most occasions, and would have been the case with all of them upon all occasions, if particular accidents had not, upon some occasions, increased the supply of some of them in a still great
- hackelly 14y agoJe voudrai hacker un compte moviestarplanet
- hackelly 14y agoJe voudrai hacker un compte moviestarplanet
- nextparadigms 14y agoLLVM seems to support 64 bit ARM, now, too: http://www.phoronix.com/scan.php?page=news_item&px=MTI4OTA http://www.phoronix.com/scan.php?page=news_item&px=MTI4O...
- Symmetry 14y agoI do wonder what on earth ARM was doing that was preventing them from including NEON support, though.
- jevinskie 14y agoLLVM now has NEON support. Was this an issue in the past?
- Symmetry 14y agoWell, the addition of LLVM support referenced in the Phoronix article had this bit: "This patch excludes the NEON support also reviewed due to an outbreak of batshit insanity in our legal department. That will be committed soon bringing the changes to precisely what has been approved." http://comments.gmane.org/gmane.comp.compilers.llvm.cvs/134902 http://comments.gmane.org/gmane.comp.compilers.llvm.cvs/1349... I'm just wondering what that was about and how serious it was.
- tehwalrus 14y agoThank you, I'd not seen this before. I have always been interested in compiler design having not been put off it by doing a computer science degree, but, having not done the degree I've also never learned anything about it. This looks like it should help. Although, I was very confused by the first couple of sentences - the author apologises for their global variables, and not knowing which part of the compiler they're talking about I don't know if they means they're going to implement kaleidoscope without any notion of scope, and just make everything global, or if they're just talking about the parser code. It's quite clear soon after that it's the latter, but it makes it difficult to read the introduction!
- gosukiwi 14y agoUh... I'm not good at C++ :(
- sepeth 14y agoThere is also OCaml version there: http://llvm.org/docs/tutorial/OCamlLangImpl1.html http://llvm.org/docs/tutorial/OCamlLangImpl1.html
- freyrs3 14y agoThere's a Python version here: http://www.llvmpy.org/llvmpy-doc/dev/doc/kaleidoscope/index.html http://www.llvmpy.org/llvmpy-doc/dev/doc/kaleidoscope/index....
- lloeki 14y agoInteresting, I'm read through the tutorial, and took the source, while tweaking it to conform to RPython, then feeding it into PyPy's translator. What strikes me is that: - with PyPy everything is implemented natively, i.e without resorting to foreign abstractions: instead of def CodeGen, I'd write def eval (or whatever my native AST evaluation wants), and instead of g_llvm_builder.fadd(left, right), I'd just do the native left+right. This makes it conceptually less of a mind split, and writing stuff like the BF interpreter is just straightforward [0]. - with LLVM, the concepts are nicely abstracted, and the API reasonably pythonic. I know I'm using LLVM but I don't feel like I'm hitting some thin C wrapper. Those concepts are ported and reinvested into other languages with ease: now that I got them by reading the python tutorial, I'm confident I can find my way in another project on another, less known to me language. Also, due to this abstracted common ground, access to functions coming from outside, (possibly other languages) is made easy. With PyPy I'm stuck to what's made available to RPython land. [0]: http://morepypy.blogspot.fr/2011/04/tutorial-writing-interpreter-with-pypy.html http://morepypy.blogspot.fr/2011/04/tutorial-writing-interpr...
- freyrs3 14y agoYour observations are pretty accurate. I'm fortunate enough to work with the maintainer of llvmpy and he's done some great work in making llvmpy pretty Pythonic. Should also check llvm-cbuilder the EDSL for building up higher level LLVM constructs: https://github.com/llvmpy/llvmpy/blob/master/README_LLVM_CBUILDER.md https://github.com/llvmpy/llvmpy/blob/master/README_LLVM_CBU...
- pretoriusB 14y agoOK, here's a question: is this the same version that was around for half a decade, or is it updated to the latest LLVM API etc?
- sanxiyn 14y agoIt is constantly updated to the latest LLVM API. Ok, it is not promptly updated, but it is updated.
- igravious 14y agoI would love a tutorial about LLVM that used a decent proper subset of scheme as its tutorial language and not a procedural language. Anyone know any?
- alexchamberlain 14y agoThere's an OCaml version of the same tutorial...
- igravious 14y agoThat's not what I meant. Maybe I was unclear. I mean that instead of the makey-uppy Kaleidoscope procedural langauge a makey-uppy mini scheme was used instead, that is to say KaleidoscopeScheme ...
- mahmud 14y agoOf course, pedagogy goes out of the window and we enter the realm of magic once we try to implement continuations. Scheme without continuations is no different than any other simple Algol. (minus GC, numeric tower, macros, etc. of course)
- super_mario 14y agoAre there any books or resources that teach how you would go about using flex, bison and llvm together to create something more substantial. I would find this incredibly useful.
- arcatek 14y agoYou can check my WIP language for an example. The following is the repository where every component (lexer, parser, compiler, running-time library) is in its own module. https://github.com/castel/libcastel https://github.com/castel/libcastel According to my experience on this language, I would recommand you ragel and lemon over flex and bison. They are very, very easy to bundle into a C++ application, without messing too much with the global symbol namespace. A nice example is the Castel lexer, which is actually a preprocessed C++ source file : https://github.com/castel/libcastel/blob/master/parse/sources/lex/Lexer.rl https://github.com/castel/libcastel/blob/master/parse/source...
- super_mario 14y agoThanks for pointing this out. I will definitely check them out.
- seivan 14y agoAmazing, thank you so much. This is so interesting. I've always wanted to look into building something small.
- Rickasaurus 14y agoThe OCaml version of the same tutorial is so much nicer http://llvm.org/docs/tutorial/OCamlLangImpl1.html http://llvm.org/docs/tutorial/OCamlLangImpl1.html
- marblar 14y agoIs the site down for everybody else?
- lenkite 14y agollvm.org has been down nearly all day.