3 ms·
> The existence of a parser does not imply its availability. As you said "Some of them don't have the parsers available at all (e.g. C)," No, but it guarantees
by devinj 16y ago
> The existence of a parser does not imply its availability. As you said "Some of them don't have the parsers available at all (e.g. C),"
No, but it guarantees that, at least in theory, such a parser could be made available. In practice many languages do make it available. Your argument was a general one, that is that all "traditional languages" have this property.
> Actually it does because there are very few "traditional languages" that even approach Python's in-language support for their own AST
It only takes one counterexample to break a general claim. "Very few" is enough. Nothing about traditional languages has any intrinsic property of being parser and AST-free-- it is merely laziness, minimalism, or coincidence that causes many to not. As examples like Python show, it is quite easy to find a mainstream "traditional language" with a full-blown (actually several full-blown) interfaces to the parser available. Other languages have this too, although examples are not incredibly widespread. Lua has implementations which provide an AST, and even the hyper-traditional language C# has the Expressions framework, which lets you parse/modify/etc. the AST of an expression (including, of course, the new lambdas).
It's just not true that Lisp is the only game in town for AST support, nor that "traditional languages" don't have it in general (although it may be true that most do not, this is not the same as claiming that as a group they do not).
- anamax 16y ago> No, but it guarantees that, at least in theory, such a parser could be made available. By that standard, all languages are equivalent. That's true in a rather meaningless sense (Turing equivalence), but very few people think that Haskell is the same as C. > it is merely laziness, minimalism, or coincidence that causes many to not. The reason doesn't matter. If you don't have reasonable "out of the box" support for manipulating ASTs, it isn't part of the language. This cuts both ways - few lisp implementations have reasonable libraries. > It's just not true that Lisp is the only game in town for AST support Feel free to show how ordinary {pick your language} programmers could implement and use something like the LOOP macro. Compare with how easily that can be done in lisp. Ease (like speed) matters.