The language being defined here is not a Lisp, it's a (trivial) language that just happens to use (something like) S expressions as the surface syntax. (The reason it's only "something like" S expressions is that it has ad-hoc commas to delimit argument lists.)
The characteristic that defines a Lisp is that code is not a sequence of characters, it's a data structure -- typically a tree of cons cells -- which can be manipulated within the language itself. The language being defined here doesn't have that property.
It is this property that allows you to write macros, which is what makes Lisp cool. Without it you don't have Lisp, you just have a run-of-the-mill programming language with weird syntax.
The parenthesis-based surface syntax is directly translated into the above, which is IMO more verbose and contains no additional information. On the other hand, it is valid Javascript data.
So it looks like it is equivalent to manipulate the above form. Now, suppose you want to define a function which returns a form which performs a function call. We won't use macros, but simply a function that builds an AST. We can't write Javascript directly with this parser, so let's say there are primitive Lispy functions to build equivalent javascript trees:
You make an interesting and important point, but to be honest the article's intended audience is people who are intimidated by language translation or just have never done it before. The "Minilisp" is not really a language so much as a tool to demonstrate the concepts of tokenizing, parsing and recursion. It is unfortunate if the result is a mischaracterization of real Lisp, but I was trying to cut a balance between being accurate and filling the article with tangential information.
That's a fine goal, but there's more at stake here than mere "accuracy". When you design a language that uses S-expression syntax (sort of) and has "Lisp" in its name, but eliminates the reason for using S-expressions, you're not really laying a foundation for understanding, you're creating a cargo cult (https://en.wikipedia.org/wiki/Cargo_cult, specifically https://en.wikipedia.org/wiki/Cargo_cult#Metaphorical_uses_o...)
Comments
The language being defined here is not a Lisp, it's a (trivial) language that just happens to use (something like) S expressions as the surface syntax. (The reason it's only "something like" S expressions is that it has ad-hoc commas to delimit argument lists.)
The characteristic that defines a Lisp is that code is not a sequence of characters, it's a data structure -- typically a tree of cons cells -- which can be manipulated within the language itself. The language being defined here doesn't have that property.
It is this property that allows you to write macros, which is what makes Lisp cool. Without it you don't have Lisp, you just have a run-of-the-mill programming language with weird syntax.
To expand a little on this, the article shows the parsed AST:
The parenthesis-based surface syntax is directly translated into the above, which is IMO more verbose and contains no additional information. On the other hand, it is valid Javascript data.So it looks like it is equivalent to manipulate the above form. Now, suppose you want to define a function which returns a form which performs a function call. We won't use macros, but simply a function that builds an AST. We can't write Javascript directly with this parser, so let's say there are primitive Lispy functions to build equivalent javascript trees:
... whereas, a lisp-based approach would be:You make an interesting and important point, but to be honest the article's intended audience is people who are intimidated by language translation or just have never done it before. The "Minilisp" is not really a language so much as a tool to demonstrate the concepts of tokenizing, parsing and recursion. It is unfortunate if the result is a mischaracterization of real Lisp, but I was trying to cut a balance between being accurate and filling the article with tangential information.
That's a fine goal, but there's more at stake here than mere "accuracy". When you design a language that uses S-expression syntax (sort of) and has "Lisp" in its name, but eliminates the reason for using S-expressions, you're not really laying a foundation for understanding, you're creating a cargo cult (https://en.wikipedia.org/wiki/Cargo_cult, specifically https://en.wikipedia.org/wiki/Cargo_cult#Metaphorical_uses_o...)