4 ms·
No. Any Lisp you can name has more to it than just s-expressions.
by krapp 8y ago
No. Any Lisp you can name has more to it than just s-expressions.
- cellularmitosis 8y agoHis point still stands. The ruby parser has 10x the number of lines of code as the clojure parser. https://github.com/ruby/ruby/blob/trunk/parse.y https://github.com/ruby/ruby/blob/trunk/parse.y https://github.com/clojure/tools.reader/blob/master/src/main/clojure/clojure/tools/reader.clj https://github.com/clojure/tools.reader/blob/master/src/main...
- lispm 8y agoBecause one parses a data format and the other one an actual programming language...
- cellularmitosis 8y agoSorry, I linked to the wrong edn reader https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/EdnReader.java https://github.com/clojure/clojure/blob/master/src/jvm/cloju...
- lispm 8y agoThat's still only an s-expression reader, not a programming language parser.
- cellularmitosis 8y agoCan you help me understand the distinction you are making? My understanding is that this is the reader used by the repl, and at least for clojure, an edn parser is the same thing as a programming language parser, because clojure programs are written in edn.
- victorNicollet 8y agoIn most programming languages, a fact like "Foreach loops have a variable binding, a collection to iterate through, and a body" is guaranteed by the parser, and the rest of the language implementation can assume that the foreach loops are well-formed and concentrate on lexical and type checks. An S-Expression parser will accept (loop for in do), and the rest of the language implementation has to deal with detecting that there is no variable, no collection and no action.
- lispm 8y agoThey are written on top, but not in. It's like claiming Ruby programs are written in characters. S-expressions know nothing and represent nothing about concepts like functions, variables, argument lists, operators, bindings, type declarations, function defintions, variable defintions, class definitions, ... Even syntactic (3 4 +) is READ successfully, but it is not a valid Clojure form. Basically a READER is on the level of a TOKENIZER, but not a parser.
- appleflaxen 8y agocan you elaborate? i'm not a lisper, so I don't understand what else would be present. I am guessing you mean things like switch statements?
- lsh 8y agoI thought maybe he meant Lisps whose compiler isn't another Lisp, or maybe macros at a stretch ..
- disconcision 8y agoVirtually every lisp uses some non s-expression syntax which must be dealt with at the reader level. For example, using ' for quotation.
- lispm 8y ago(3 4 +) (2 + 3) (- 3 4) All are valid s-expressions. Only one is a valid Lisp expression.
- kazinator 8y agoOr, in ANSI CL terms, only one is a valid form (S-expression suitable for or subject to evaluation).
- lispm 8y agoA form is already 'read' - it's an object. When we parse an expression, we usually parse a textual representation into an object. If the object is meant / subject to evaluation -> then we call this a form.
- kazinator 8y ago'(a b c) is considered an S-expression in Lisp dialects which support the 'X <-> (quote X) shorthand. It's just a shorthand, and it is read-print consistent, like other such shorthands. If '(a b c) isn't a S-exp, then we have backed into uncomfortable corners in which #(a b c) isn't an S-exp. Every character in a S-expression must be "dealt with at the reader level" (and produced at the printer level). The term "S-expression" was originally in contrast with "M-expression", but that's a historic usage.