4 ms·
This tutorial is multipart, the code emitting is in the 3rd part.
by jermaustin1 6y ago
This tutorial is multipart, the code emitting is in the 3rd part.
- kerkeslager 6y agoI'll believe it when I see it.
- zachrip 6y agoI'll take "what is due diligence" for 300, Alex.
- kerkeslager 6y agoI guess I was technically wrong in that it does have an emitter, but I wasn't wrong in that it still doesn't emit assembly. gcc (or whatever you're using to compile your C) is still doing all the nuclear reactor part.
- azhenley 6y agoVery few "commercial" compilers emit assembly directly. They use LLVM or C or some other intermediate language.
- kerkeslager 6y agoSorry that I'm coming across as critical of your work here--that wasn't my intent but I didn't do enough to avoid it. Your article isn't the problem, it's just proximal to the problem I'm describing. I should have been more clear about that in my post. To address your post: I'm not aware of any widely used compilers that compile from a general-purpose language to C. There are a handful of DSLs that do, and there may be some mainstream general-purpose language compiler that does that I don't know of. Compiling to LLVM or GCC's RTL has a lot more in common with compiling to Assembly than it does with compiling to C. Compiling to LLVM/RTL/assembly is fundamentally different from compiling to another high-level language. When compiling to C for example, you get to compile your for loops into C for loops--it's a fairly easy one-to-one conversion. Compiling to conditional jumps is a much more complicated endeavor, requiring more architecture.
- jermaustin1 6y agoI believe what you are meaning by assembly is native code or the executable bytes that a compiler/linker/assembler output? Assembly is just another language (or more precisely: family of languages).
- kerkeslager 6y agoI wasn't confused about what assembly was. Compiling a for loop to a slightly different syntax of for loop is a much different problem from compiling a for loop to conditional jumps.
- azhenley 6y agoThe emitter was released 11 days ago. The links to part 2 and 3 are in the first line of this blog post.
- jermaustin1 6y agohttps://web.eecs.utk.edu/~azh/blog/teenytinycompiler3.html https://web.eecs.utk.edu/~azh/blog/teenytinycompiler3.html
- dang 6y agoPlease don't be a jerk on HN. I'm sure you don't mean to be, but comments like this can really come across the wrong way. That's one reason the site guidelines include: "Please don't post shallow dismissals, especially of other people's work. A good critical comment teaches us something." https://news.ycombinator.com/newsguidelines.html https://news.ycombinator.com/newsguidelines.html
- kerkeslager 6y agoI don't personally think the fact that there are hundreds of other articles that already cover the same topic in greater depth is a shallow dismissal, and I think that could teach people something. But I'm open to the possibility that I maybe could have communicated this in a kinder way. Do you have any suggestions on how?