r/Compilers • u/naharashu • 2d ago
Any good llvm or compiler tutorials using C++?
I read the kaleidoscope but it doesnt explain some things for my language that i need
1
Upvotes
r/Compilers • u/naharashu • 2d ago
I read the kaleidoscope but it doesnt explain some things for my language that i need
4
u/codechutney 2d ago
heyyy , learning the same would , wanna discuss about the same ?
10
u/shrimpster00 2d ago
Like most things, if you want to do something particularly technical, you just have to read the docs.
1
u/-Memnarch- 2d ago
What exactly do you need for your language? Whener I don't know any further, I ask the google ai for hints and examples. Usually gets the ball rolling.
1
u/Legitimate_Flan1471 1d ago
if you want to build a compiler that outputs LLVM IR, then i can recommend this here (although not c++ specific):
https://mapping-high-level-constructs-to-llvm-ir.readthedocs.io/en/latest/index.html
1
u/Discordbothost 1d ago
I'd start with a growable array of one element type, like integers. Give it a data pointer, a length and a capacity. Make append work when there's spare capacity, then test appending one more element when the array is full. That separates what LLVM needs to lay out from what your runtime needs to allocate and copy.