Show HN: A compiler for a small language into x86-64 assembly
1–10 of 23 posts
Re: Show HN: A compiler for a small language into x86-64 assembly
#2I tried to follow the Assembly calling conventions the best I could.
I am looking forward to any feedback!
Re: Show HN: A compiler for a small language into x86-64 assembly
#3This is my first compiler, so I expect there to be several things I can improve :) I tried to follow the Assembly calling conventions the best I could. I am looking forward to any feedback!
Re: Show HN: A compiler for a small language into x86-64 assembly
#4Re: Show HN: A compiler for a small language into x86-64 assembly
#5This is my first compiler, so I expect there to be several things I can improve :) I tried to follow the Assembly calling conventions the best I could. I am looking forward to any feedback!
Re: Show HN: A compiler for a small language into x86-64 assembly
#6You can try FASM ( http://flatassembler.net ) besides YASM and ld.
Then (last year or something) I find out YASM is actually intended to be an improvement to NASM, which I've used for about 6 years. And now I find out FASM is an improvement on YASM? How deep does this go??
To clarify: I had heard of all of these different assemblers and at some point looked at their websites but it was a very, very long time ago :)
Re: Show HN: A compiler for a small language into x86-64 assembly
#7Re: Show HN: A compiler for a small language into x86-64 assembly
#8This is my first compiler, so I expect there to be several things I can improve :) I tried to follow the Assembly calling conventions the best I could. I am looking forward to any feedback!
The syntax flows well, in fact it feels very intuitive for my taste. I like the type inference and no semicolons. I wonder if the latter posed any trickiness, for example, with the next line starting with an expression "(" or operator like "+".
I'm also curious about use cases, what is possible with this language. I guess anything assembly can do - which is..everything? :) Would it be suitable to run on microcomputers like Raspberry Pi?
EDIT: The Pi and Arduino are typically ARM, it seems, with a different instruction set. Well, that shows how little I know.
Re: Show HN: A compiler for a small language into x86-64 assembly
#9Curios if you looked into ANTLR? That's what was used most recently as part of my compiler's course at Georgia Tech.
But decided, that for the first compiler, I want to actually do all steps manually myself for best possible comprehension of the general topic.
Re: Show HN: A compiler for a small language into x86-64 assembly
#10This is my first compiler, so I expect there to be several things I can improve :) I tried to follow the Assembly calling conventions the best I could. I am looking forward to any feedback!
Congratulations! It looks like a useful and practical design. How is the performance of the generated code? What are you thinking about doing for memory management? Have you thought about using an intermediate representation to make optimization and retargeting easier?
Yes, I thought about going for LLVM or another representation but decided to do it once myself (no given performance optimizations or the like) with room for improvement.