Creating a language using only assembly language
speakerdeck.com
Creating a language using only assembly language
1–10 of 67 posts
Re: Creating a language using only assembly language
#2The title might not do it justice; the point is: there's very little assembly language involved, if you're careful.
Re: Creating a language using only assembly language
#3Re: Creating a language using only assembly language
#4Re: Creating a language using only assembly language
#5This is the coolest thing I've seen posted on HN in awhile. The title might not do it justice; the point is: there's very little assembly language involved, if you're careful.
ps: I remember an article with a similar structure but using lambda calculus. Starting with very poor subset and gradually expanding features... Too bad I can't find it again.
Re: Creating a language using only assembly language
#6Very neat. If you find this interesting you may also like jonesforth, another project developing a language starting from assembly. http://git.annexia.org/?p=jonesforth.git;a=summary
Re: Creating a language using only assembly language
#7This is the coolest thing I've seen posted on HN in awhile. The title might not do it justice; the point is: there's very little assembly language involved, if you're careful.
I smell bootstrap. #onto-reading ps: I remember an article with a similar structure but using lambda calculus. Starting with very poor subset and gradually expanding features... Too bad I can't find it again.
Re: Creating a language using only assembly language
#8Earlier quoted context omitted.
I smell bootstrap. #onto-reading ps: I remember an article with a similar structure but using lambda calculus. Starting with very poor subset and gradually expanding features... Too bad I can't find it again.
Is it this project? http://matt.might.net/articles/implementing-a-programming-la...
Re: Creating a language using only assembly language
#9https://github.com/k1w1/javelin-stamp/blob/master/asm/javeli...
Until I looked at it again now I had forgotten my favorite instruction, a nop to avoid a bug in the silicon:
https://github.com/k1w1/javelin-stamp/blob/master/asm/javeli...
Re: Creating a language using only assembly language
#10I started basically by having the compiler do very basic parsing of M68k assembler and just pass everything that looked like assembler straight through.
Then I added support for defining functions, but all the content of functions was still assembler. Then I started adding expression support and things like local variable and types.
I wish I still had the source (lost in a move, long after I stopped doing anything on it) - one of the fun things about it was that I kept the ability to intersperse assembler instructions everywhere - they were treated as normal statements. And the M68k registers were first class variables in the language that could occur in any expression. So e.g. you could write "D0.w = D1.w + a", where D0.w would refer to the low 16 bits of the D0 register, and D1.w the low 16 bits of the D1 register, and "a" would be a variable allocated on the stack.
Basically the features I added were largely guided by what seemed like it'd let me shave more lines off the compiler itself...
You learn a lot about the language you're writing when you bootstrap from asm or try to condence everything into a tiny core - a lot dependencies in the language that are non-obvious becomes a lot clearer.