Live data from Hacker News

Show HN: A compiler for a small language into x86-64 assembly

github.com

21–23 of 23 posts

Re: Show HN: A compiler for a small language into x86-64 assembly

#21

This 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!

Sorry I won't be able to give you a lot of feedback.

As a matter or preference I really like colons and semi-colons.

That said your work is amazing. This is a true example of simplicity. I don't think most of people would get how difficult it is to keep it simple.

Everything is clear I can read the source code without asking myself "what is that", everything makes sense.

Thanks for presenting your work.

Do you have any constraints, like "no meta programming", "generated library should be as much as possible compatible with C", "it should have one pass optimization" or even "the compiler must be embeddable in most place as possible" ?

Re: Show HN: A compiler for a small language into x86-64 assembly

#22
post #21

This 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!

Sorry I won't be able to give you a lot of feedback. As a matter or preference I really like colons and semi-colons. That said your work is amazing. This is a true example of simplicity. I don't think most of people would get how difficult it is to keep it simple . Everything is clear I can read the source code without asking myself "what is that", everything makes sense. Thanks for presenting your work. Do you have…

Nothing wrong with semi-colons. Everyone has a different preference anyway.

Thanks for saying all that. It was a huge amount of work and getting appreciation makes it all worth it!

No hard constraints as of now. But I don't think I want to include meta programming or a pre-processor (don't really like it to be honest). I do want to keep it compatible with C internally, on Assembly level. One thought is, to create a file with function headers/definitions that are then dynamically linked and can just be used.

I used some C std library functions that way for debugging (printf, ...). And as I follow the standard calling conventions, the compiler should automatically generate compatible code.

With this, it would also be possible, to write OpenGL code. That would be really awesome :)

As of usage of my language - Not sure yet. Up until now, the road was more of the goal then the finished language.

Re: Show HN: A compiler for a small language into x86-64 assembly

#23

This 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!

very cool. I'm writing a compiler and language myself and I was on the fence about anonymous structs / tuples vs multiple returns, and seeing multiple returns in your examples nudged me that way. I'm also influenced by Lua and I picked it up in your grammar right away : )

It's a bit of pain to implement in some cases, but worth it :)

Let me know, if you have questions or need hints where to find some relevant details in my code.

Post reply on HN