Implement a programming language in 7 lines
matt.might.net
Implement a programming language in 7 lines
1–10 of 18 posts
Re: Implement a programming language in 7 lines
#2The good news is that I now know where the name Y Combinator comes from. I imagine it will take me a lot longer to wrap my head around that concept, though. Truly weird haha.
Re: Implement a programming language in 7 lines
#3Re: Implement a programming language in 7 lines
#4This one is a cheat because read does a lot of the work. I can tolerate treating STDIN/OUT as black boxes because they often are. The Scheme interpreter's functionality is what's custom. The read function is crucial to it. So, it's implementation should be included. That puts this way over 7 lines. The good news is that I now know where the name Y Combinator comes from. I imagine it will take me a lot longer to wrap…
Re: Implement a programming language in 7 lines
#5This one is a cheat because read does a lot of the work. I can tolerate treating STDIN/OUT as black boxes because they often are. The Scheme interpreter's functionality is what's custom. The read function is crucial to it. So, it's implementation should be included. That puts this way over 7 lines. The good news is that I now know where the name Y Combinator comes from. I imagine it will take me a lot longer to wrap…
Eh, "implement X in Y lines" for Y < 10 is pretty much always a cheat. At least this cheat has solid computer science behind it; most such cheats boil down to "import library; library.cheat()", or, for the particular "implement a programming language", JavaScript "eval".
Re: Implement a programming language in 7 lines
#6This one is a cheat because read does a lot of the work. I can tolerate treating STDIN/OUT as black boxes because they often are. The Scheme interpreter's functionality is what's custom. The read function is crucial to it. So, it's implementation should be included. That puts this way over 7 lines. The good news is that I now know where the name Y Combinator comes from. I imagine it will take me a lot longer to wrap…
Re: Implement a programming language in 7 lines
#7This one is a cheat because read does a lot of the work. I can tolerate treating STDIN/OUT as black boxes because they often are. The Scheme interpreter's functionality is what's custom. The read function is crucial to it. So, it's implementation should be included. That puts this way over 7 lines. The good news is that I now know where the name Y Combinator comes from. I imagine it will take me a lot longer to wrap…
Eh, "implement X in Y lines" for Y < 10 is pretty much always a cheat. At least this cheat has solid computer science behind it; most such cheats boil down to "import library; library.cheat()", or, for the particular "implement a programming language", JavaScript "eval".
https://gist.github.com/sanxiyn/523967
It was one of many from the link below. The Scheme in Racket example would've been even easier to specify concretely because it's so easy to implement read in a Scheme. Gets the C and C++ implementations more props for doing things directly. Real question is how small can those go?
Re: Implement a programming language in 7 lines
#8This one is a cheat because read does a lot of the work. I can tolerate treating STDIN/OUT as black boxes because they often are. The Scheme interpreter's functionality is what's custom. The read function is crucial to it. So, it's implementation should be included. That puts this way over 7 lines. The good news is that I now know where the name Y Combinator comes from. I imagine it will take me a lot longer to wrap…
I do recommend learning the Y Combinator; it's the answer to the problem "How do I have a recursive anonymous function?"
I do agree that the realization that it's possible to build recursive functions in the lambda calculus is mind-blowing (and far from obvious!)
Re: Implement a programming language in 7 lines
#9This one is a cheat because read does a lot of the work. I can tolerate treating STDIN/OUT as black boxes because they often are. The Scheme interpreter's functionality is what's custom. The read function is crucial to it. So, it's implementation should be included. That puts this way over 7 lines. The good news is that I now know where the name Y Combinator comes from. I imagine it will take me a lot longer to wrap…
Re: Implement a programming language in 7 lines
#10This one is a cheat because read does a lot of the work. I can tolerate treating STDIN/OUT as black boxes because they often are. The Scheme interpreter's functionality is what's custom. The read function is crucial to it. So, it's implementation should be included. That puts this way over 7 lines. The good news is that I now know where the name Y Combinator comes from. I imagine it will take me a lot longer to wrap…
Even the classic lisp eval that fits in a page, puts aside cons (aka gc). It's funny how different the problem they were describing was to put away memory as an implementation detail.