Interesting languages that aren't on the list of implementations: APL/J/Kx Verilog Fortran LISP 1.5
Mal – Make a Lisp
11–20 of 41 posts
Re: Mal – Make a Lisp
#12I 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
Regex to parse lisp expressions?
Re: Mal – Make a Lisp
#13Re: Mal – Make a Lisp
#14Earlier quoted context omitted.
Regexes are at least useful for parsing numbers and symbols. But yeah, that shouldn't be where you get stuck.
[\s,] (~@|[\[\]{}()'`~^@]|"(?:\\.|[^\\"]) "?|;. |[^\s\[\]{}('"`,;)] ) Step 0, so I didn't get very far. https://github.com/kanaka/mal/blob/master/process/guide.md#s...
Re: Mal – Make a Lisp
#15Re: Mal – Make a Lisp
#16I 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, hi…
Re: Mal – Make a Lisp
#17Re: Mal – Make a Lisp
#18I 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
static public List Tokenizer(string source)
{
// Initialise the token list.
List tokens = new List();
// Define a regex pattern whose groups match the MAL syntax.
string pattern = @"[\s ,]*(~@|[\[\]{}()'`~@]|""(?:[\\].|[^\\""])*""|;.*|[^\s \[\]{}()'""`~@,;]*)";
// empty ~@ | specials | double quotes |; | non-specials
// Break the input string into its constituent tokens.
string[] result = Regex.Split(source, pattern);
This took a while to understand and get going but it really improved my understanding of regex.Re: Mal – Make a Lisp
#19I was massively pleased when I got MAL to self-host.
[0] https://www.non-kinetic-effects.co.uk/blog/2019/04/28/MAL-5
Re: Mal – Make a Lisp
#20- 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.