6 ms·
Mal – Make a Lisp
- Y_Y 6y agoInteresting languages that aren't on the list of implementations: APL/J/Kx Verilog Fortran LISP 1.5
- lhjn 5y agoI have a Dyalog APL implementation since 1 year or more on my fork, but still haven't released it because for reasons related to the input/output handling it cannot pass the self hosting tests :( To make the other tests pass, i wrapped the interpreter in a shell scripts that merges stdout and street, and that did the job for all bit the last step (self hosting). The self hosting interpreter (albeit very slow), appears to be working correctly when used interactively
- lhjn 5y agoIf interested, https://github.com/laynor/mal/tree/dyalog https://github.com/laynor/mal/tree/dyalog
- jmrm 6y agoAlso COBOL and VHDL. I don't know how a hardware description language could implement a Lisp variant btw.
- rjsw 6y agoThere is a Verilog implementation of the MIT Lisp Machine.
- Y_Y 6y agoThey actually do include a VHDL implementation! COBOL would be cool though.
- sedachv 6y ago> I don't know how a hardware description language could implement a Lisp variant btw. https://dspace.mit.edu/handle/1721.1/6334 https://dspace.mit.edu/handle/1721.1/6334
- nicklecompte 6y agoI was a bit surprised nobody’s tried a “verified” implementation in something like Coq/Idris/Agda (unless i missed one - I wasn’t familiar with all the languages in the list). Might be a fun project!
- progre 6y agoOne interesting thing about this project is the extensive use of Make. Not only is the test suite Make based, there is also a Mal implementation in Make
- harryvederci 6y agoIf I recall correctly, the project started as "Make Lisp" (a lisp made with Make), and later changed to "Make A Lisp".
- macintux 6y agoI attempted this a few years back, didn't get far before I got hung up on the regular expression(s) required for parsing. Silly to get stopped there, but there was just enough friction between the specified expression, the language I was using (Erlang), and my understanding of the subtleties that I punted. I think with Regex101 in my back pocket I'll give it another try. https://regex101.com https://regex101.com
- duncaen 6y agoRegex to parse lisp expressions?
- the-smug-one 6y agoRegexes are at least useful for parsing numbers and symbols. But yeah, that shouldn't be where you get stuck.
- macintux 6y ago[\s,](~@|[\[\]{}()'`~^@]|"(?:\\.|[^\\"])"?|;.|[^\s\[\]{}('"`,;)]) Step 0, so I didn't get very far. https://github.com/kanaka/mal/blob/master/process/guide.md#step0 https://github.com/kanaka/mal/blob/master/process/guide.md#s...
- cellularmitosis 6y agoWhoa that regex is a monster. Try starting with simpler pieces and see if you get further this time around. Good luck! https://gist.github.com/cellularmitosis/75dc4aefe88438c14e9433f8728342d1 https://gist.github.com/cellularmitosis/75dc4aefe88438c14e94...
- the-smug-one 6y agoWell, you certainly don't need that regex to implement a Lisp.
- kanaka 6y ago
- miloignis 6y agoI went through MAL last year and had a blast! It's an excellent project to help you get a feel for Lisps and tiny languages, and I think is what finally got me over my "eww parentheses" feeling. After finishing MAL, I modified it to implement John Shutt Kernel-style f-exprs to really up the power-to-weight ratio, and had a blast doing it. MAL makes a great basis for experimenting with additional language features, highly recommended!
- diminish 6y agoI liked MAL similar to Linux from scratch (LFS).
- KineticLensman 6y agoI did this a while back. I documented my experience in several blog posts, the last of which is [0]. These describe the process, the gotchas and how I got round them. I was working on C# on a Windows box so the result isn't quite the same as the vanilla MAL. I was massively pleased when I got MAL to self-host. [0] https://www.non-kinetic-effects.co.uk/blog/2019/04/28/MAL-5 https://www.non-kinetic-effects.co.uk/blog/2019/04/28/MAL-5
- primer-1 5y agoWhat was your approach to running the tests under Windows?
- KineticLensman 5y agoI executed the test files manually. Unfortunately.
- tom_mellior 6y agoI went through this a while ago (in Prolog). It was interesting, but with a lot of room for improvement. My criticisms as I remember them: - Error messages about output being different from the expected use some sort of very explicit printing mode with lots of quotes and escaping. A message saying that one got "\\\'\\\'" where "\'\\\\'" was expected is needlessly hard to parse when the actual difference is \'\' vs. '\\' (or whatever). - Many parts are marked optional, but the test script complains if you don't implement them, and later sections assume that they are implemented, so you have to treat them as compulsory anyway. - Some things regarding environment updates were contradictory or at least not explained properly at first, with some very relevant information only coming later. I don't remember the specifics, but the problem was roughly that I set up my data structures thinking that everything could be implemented in a pure way, but at some point it became clear that you either need some other data structure or must use destructive modifications.
- kanaka 6y ago- There are several reasons for the weird way that the output and expected messages are printed. One of the main reasons is that in order to enable more flexible test case results, the expected output is a regex rather than a plain string, while the output is just a plain string. There is probably a way this could be made clearer. I'll add it to my TODO list to look at. - Do you have some specific examples? The test cases are marked as either deferrable or optional. You shouldn't ever have to implement optional (and if so that's a bug in the tests or the guide). I think the deferrable items are marked pretty clearly in the guide where they become mandatory in later steps. If it's not clear, then that's a bug. - This is one of the tensions that exists with trying to make the guide incremental; later features may require re-work of earlier functionality. I do try and minimize that as much as possible although I've found it can really vary depending on the nature of the target language. Note that the primary goal of mal/make-a-lisp is pedagogical (as opposed to say "the easiest way to make your own Lisp"). So sometimes the need to go back and re-work something is in line with that goal. If you have any concrete guide text or test driver improvements (especially that further the pedagogic goals of mal), I'm always happy to review pull requests! :-)
- 6y ago
- dang 6y agoIf curious, past threads: Mal – Make a Lisp, implemented in 79 languages - https://news.ycombinator.com/item?id=21670442 https://news.ycombinator.com/item?id=21670442 - Nov 2019 (11 comments) Mal – Make a Lisp, in 68 languages - https://news.ycombinator.com/item?id=15226110 https://news.ycombinator.com/item?id=15226110 - Sept 2017 (69 comments) Mal – Make a Lisp - https://news.ycombinator.com/item?id=12720777 https://news.ycombinator.com/item?id=12720777 - Oct 2016 (1 comment) Make a Lisp - https://news.ycombinator.com/item?id=9121448 https://news.ycombinator.com/item?id=9121448 - Feb 2015 (41 comments) Lisp implemented in under 1K of JavaScript - https://news.ycombinator.com/item?id=9109225 https://news.ycombinator.com/item?id=9109225 - Feb 2015 (16 comments)
- pygy_ 6y agoThis is unintentional given the history of the name of the project explained in another comment on this page, but "mal" in French means "evil", tying into the famous aphorism.
- rbonvall 6y agoIn Spanish it means "badly", which is an encouraging goal to give the project a try :)
- andredz 6y agoIn Spanish it also means evil. Example: No seas vencido por el mal, sino vence con el bien el mal. Do not be overcome by evil, but overcome evil with good.
- kanaka 6y agoI wouldn't say it was entirely unintentional :-). I was definitely aware that "mal" could mean "evil" when I named it. It was a bit more apropos when mal only had a single implementation in GNU Make macro language.
- pygy_ 5y agoHehe :-)
- diego898 6y agoMichael Nielsen's "Lisp as the Maxwell’s equations of software" [1] was my first exposure to this in python, and I highly recommend it! [1]: https://michaelnielsen.org/ddi/lisp-as-the-maxwells-equations-of-software/ https://michaelnielsen.org/ddi/lisp-as-the-maxwells-equation...