Re:Ask HN: Why do people say "Lisp has no syntax"? It has in...
by ventuspilot on Monday August 05, 2024 @03:02AM
(#41158754)
Most programming languages are defined in terms of program text, Lisp is not. Lisp is defined in terms of in-memory structures and what happens if you pass these in-memory structures to a hypothetic of actually existing function "eval".
With this way of viewing things your "( is actually a command" no longer is useful/ no longer makes sense. (I wouldn't say you're completely wrong, though, just that another view of things seems simpler to me.)
You could probably implement a Lisp with a scanner and a parser but things are a lot easier if you follow the traditional read-eval route (or preferably read-macroexpand-eval).
Re:Ask HN: Why do people say "Lisp has no syntax"? It has in...
by ofalkaed on Monday August 05, 2024 @03:41PM
(#41164730)
So I am just seeing Tcl and Forth everywhere. You go a bit over my head with your explanation but you have given me enough to sort this all out myself, pointed out a few gaps in my general understanding of things. Thanks.
Re:Ask HN: Why do people say "Lisp has no syntax"? It has in...
by kagevf on Tuesday August 06, 2024 @05:35PM
(#41175630)
In Common Lisp, '(' is a macro character that triggers a reader macro to read/parse the list it surrounds with a pair ')'.
More info: https://gist.github.com/chaitanyagupta/9324402
This one demonstrates how what's read in can be parsed - sort of a "Lisp in Lisp" version of eval: https://stevelosh.com/blog/2016/06/symbolic-computation/#s11...
Edit: What I am saying is that in lisp '(' is actually a command and everything after it is an argument to that command. The syntax is command - arguments; this is what gives these languages their power, the simple syntax and lack of grammar allows us to define our own grammar. Hopefully someone will correct me if I misunderstand, I could be seeing Tcl and Forth everywhere since I have been primarily working with them lately.