← Back to context

Comment by matheusmoreira

2 years ago

I have a lot of respect for lisp and its heritage. Respect is certainly one reason why I chose to write a lisp.

Other reasons include simplicity, practicality and ease of implementation. Lisp has a very simple syntax and it is relatively easy to parse it and implement a basic interpreter. I wrote the lexer and the parser by hand, there was no need to mess around with parser generators.

Another reason is I've come to see lisp as something of a frontend for C data structures. I have a byte buffer, encoded text, linked lists, resizable arrays, hash tables... Lisp is the language that binds them all together.

Another reason is that I knew how powerful lisp was despite the simplicity. Despite being a small project, lone is already metaprogrammable with FEXPRs. It turned out I needed exactly one bit in order to give lone macros.

  if (function->function.flags.evaluate_arguments) {
    arguments = lone_evaluate_all(lone, module, environment, arguments);
  }

It just doesn't evaluate the arguments if it's a macro. The function gets the lists that represent the expressions of each argument instead of the final value they compute to. And those lists can be manipulated just like any other list.

I think that was the moment I got the fabled enlightenment they say lisp programmers experience. It just brings a smile to my face.