orangeduck / BuildYourOwnLisp

Learn C and build your own programming language in under 1000 lines of code!
http://www.buildyourownlisp.com/
Other
2.9k stars 394 forks source link

Syntax for Lambda expressions #167

Closed lewismj closed 2 years ago

lewismj commented 2 years ago

Hi, I was just wondering about the syntax for the lambda expressions, i.e. you have:

(\x {x y} {+ x y}) this is so that the formals and body are not evaluated immediately? i.e. treat them as quoted expressions?

My query is , could you change the parser so that if you know you are in a lambda expression, last symbol = \ or 'lambda' ; then you set the type to 'q-expression' if that makes sense. The {} seems (quite neat but non standard) way of simplifying the parsing a bit?? Or have I missed something?