Computer Science Educators Asked by Joshua Segal on August 21, 2021
I think the https://llvm.org/docs/tutorial/index.html assumes you know too much. It’s written in an unfamiliar language to me, OCaml, and they assume you know about lexers, parsers, AST. Any thorough beginner tutorials out there?
As stated in Buffy's answer, you'll want to first be familiar with the other steps of compilation, because code generation is typically the last step in the compiler pipeline. If you haven't already, I'd suggest looking in to lexing and parsing as well. Optimization is nice as a bonus, but llvm does a good deal of optimization on its IR by itself.
Once you're familiar with the general outline of how a compiler works, you can start building one yourself. There is a language that is designed to be easy to build a llvm compiler for, called Kaleidoscope, and I'd recommend looking up a tutorial for building a Kaleidoscope compiler in whatever language you choose. llvm has bindings to many different languages ranging from haskell to C, although you will likely have the best experience learning in C++ since that's how llvm's API is implemented.
Answered by thesecretmaster on August 21, 2021
This isn't really an answer, but a suggestion that before you try to jump into tools that enable/facilitate compiler construction, you need to study the key ideas. If you don't know anything at all of scanning, parsing, optimization, and code generation, the tools are just gibberish.
Since you say this is for a course, look to the text assigned, I think. The standard is by Aho, Lam, Sethi, and Ullman. There are simpler ones, but ASTs are pretty fundamental.
Almost any good book will have an early overview of the process.
Answered by Buffy on August 21, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP