The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

beeegeee (4) [Avatar] Offline
#1
Clojure in Action 2E version 3 p.13

"To summarize, the reader converts source code into an AST implemented using Clojure’s own data structures. The reader does this by using parentheses (and other brackets) as delimiters of each s-expression. In essence, the combination of the brackets and the reader allows code to be written in the AST directly. This is the reason why it’s sometimes said that Lisp has no syntax. It’s probably more accurate to say that Lisp has no concrete syntax.
After all, as described earlier, language processors discard concrete syntax once the AST is created."

1. It seems to me that you've made a stronger case for Clojure source code syntax is readily parsed directly into an AST than for the case that Clojure Reader implements the AST as Clojure symbols, lists, vectors, etc.
2. The Reader needs punctuation in the source code to delimit each s-expression and that punctuation includes among other things, parentheses for lists, brackets for vectors, and spaces for symbols. Sometimes parentheses and brackets are mentioned and other times just brackets.
3. I've never heard it said that Lisp has no syntax; the source code definitely does. I believe the point is that Clojure syntax allows the Reader to avoid some compilation steps that are required by other languages.
amitrathore (132) [Avatar] Offline
#2
Re: Comments on the Reader to AST Description
Fair enough, I've made the point about the AST being implemented in Clojure data-structures a bit stronger, by inserting a few sentences in a paragraph that follows, under the section "The Macro System"

Here's a quote from Paul Graham, one of the most well-known folks from the Lisp community - "Lisp looks strange not so much because it has a strange syntax as because it has no syntax; you express programs directly in the parse trees that get built behind the scenes when other languages are parsed, and these trees are made of lists, which are Lisp data structures." Reference: http://www.paulgraham.com/icad.html
aranaea (1) [Avatar] Offline
#3
Re: Comments on the Reader to AST Description
I'm getting a lot out of this book but wanted to make a comment on this section. I struggled a bit to understand what you meant by:

"To summarize, the reader converts source code into an AST implemented using Clojure’s own data structures."

And then was frustrated by the follow up sentence:

"To reiterate, code is written in the language’s own data structures."

I didn't find the repetition of the same statement clarifying. It would be much more helpful if you could restate this in a different way.

I think that what you're saying here is that the AST ends up being represented textually using Clojure syntax. The AST is not in byte-code or some other lower level representation. My assumption, then, is that all of the "special" syntax is converted and all macros are evaluated leaving only the most rudimentary Clojure syntax. But that's not really clear to me from this section.
amitrathore (132) [Avatar] Offline
#4
Re: Comments on the Reader to AST Description
Sounds good - i've fixed it to add clarity. Thanks for writing in!