TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

A Complete Guide to LLVM for Programming Language Creators

402 pointsby mseriover 4 years ago

12 comments

ufoover 4 years ago
A question for the LLVM experts here:<p>In the past when I&#x27;ve looked at LLVM from a distance, the biggest stumbling block I found were that it&#x27;s written in C++ , which isn&#x27;t the language I&#x27;m using for my frontend.<p>How important is the C++ API in practice? Are the bindings for other languages usable? Is it possible to have my frontend emit LLVM IR in a text format, similarly to how you can feed assembly language source code to an asssembler? Or should one really just bite the bullet and use C++ to generate the IR? I noticed that the compiler in this tutorial has a frontend in Ocaml and a backend in C++, with the communication between them being done via protobufs.
评论 #25541623 未加载
评论 #25540725 未加载
评论 #25540637 未加载
评论 #25541447 未加载
评论 #25542921 未加载
评论 #25542608 未加载
评论 #25542897 未加载
评论 #25542412 未加载
评论 #25542924 未加载
finiteloopover 4 years ago
As someone who writes a lot of toy languages, I made this scaffolding for a LLVM-based compiler: <a href="https:&#x2F;&#x2F;github.com&#x2F;finiteloop&#x2F;compiler" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;finiteloop&#x2F;compiler</a><p>It uses Bison and Flex for parsing and lexing unlike this post, but may be a useful starting point for those building their own toy languages.
评论 #25540963 未加载
评论 #25540742 未加载
mrathi12over 4 years ago
While we&#x27;re here, let&#x27;s not forget about the incredible Kaleidoscope tutorial. They really helped me get a grip with LLVM.<p><a href="https:&#x2F;&#x2F;llvm.org&#x2F;docs&#x2F;tutorial&#x2F;index.html" rel="nofollow">https:&#x2F;&#x2F;llvm.org&#x2F;docs&#x2F;tutorial&#x2F;index.html</a>
评论 #25543648 未加载
TazeTSchnitzelover 4 years ago
&gt; LLVM IR looks like a more readable form of assembly<p>I think assembly is more readable than the dumped LLVM IR output of a real compiler…<p>Anyway, that was a good overview of how to build simple LLVM IR. :)
评论 #25540444 未加载
评论 #25542539 未加载
CGamesPlayover 4 years ago
It’s possible I missed this from the article, since I’m not actually following along, but why do I need to create the custom C++ adapter? The article mentions both ll bc formats, but I don’t see how they are used?<p>If I wanted to target LLVM, why wouldn’t I emit ll or bc files?
评论 #25541032 未加载
HexDecOctBinover 4 years ago
Is there a similar resource for liblldb? The only documentation I could find was the Doxygen-based one, and it doesn&#x27;t provide enough hints to a newcomer to know where to get started if I want to write a debugger frontend.
joozover 4 years ago
When I studied compilers back in the university, the subject consist in reading understanding and putting in practice the &#x27;dragon book&#x27; (not the full book but a big part of it). We all used flex+yacc and a simplified ASM that was interpreted by some educational software which name I cant remember. The project for the year was to implement a basic compiler language: included if&#x2F;for loops, function calls, recursivity ... basic stuff but enough as starting point to build something.<p>Trying to get into LLVM, Id love to find an example done in flex+yacc vs the same done in LLVM.
评论 #25543678 未加载
mraza007over 4 years ago
Really loved reading it. It made it so much easier for me understand LLVM.<p>Just wanted to appreciate you for writing this awesome guide
评论 #25542959 未加载
ithkuilover 4 years ago
Does anybody know a good resource like this but for writing backends for a new cpu ISA?
评论 #25543128 未加载
评论 #25542254 未加载
nevi-meover 4 years ago
I&#x27;m playing around trying to create a JIT execution engine for Rust code. I was struggling a bit with the codegen part, so the description of the function structure helped make more sense of what I&#x27;m trying to do.<p>Thanks
kevindeasisover 4 years ago
Thanks for this, I used to have other resources too about 3 years ago when I was making my own toy blockchain project that takes in a programming language to create smart contracts<p>let me see if i can still find those
jtsiskinover 4 years ago
LLVM: used to be “Low Level Virtual Machine”, but the acronym no longer applies<p>IR: intermediate representation