Lisp has no syntax. Lisp has no parentheses. Lisp as no lists.

Posted by Aaron Feng Mon, 28 Apr 2008 03:49:00 GMT

Lisp is often viewed as strange in syntax and parentheses centric language that only thing it cares about is processing lists. After all, the name is derived from LISt Processing (LISP). But it couldn't be more wrong!

Pascal Bourguignon has a great post on the lisp mailing explain why Lisp has no syntax. Lisp has no parentheses. Lisp as no lists. For the lazy readers, who don't want to click on the link, I'll give a simple break down of the Bourguignon's post.

Lisp has no syntax

Anyone with knowledge of how a compiler works would know that the job of a parser is to create a parse tree. The parser has knowledge of the syntax of the language so it can transform tokens from the source code into a tree structure. The reason Lisp doesn't have a concrete syntax is because the source code is in parse tree syntax. A parse tree can be represented in many formats.

Lisp has no parentheses

In lisp, a list is constructed by placing elements in the list between parentheses and leading the first parenthesis with a single quote. For example '(a b c). Internally lisp doesn't store or know anything about parentheses.

Lisp has no list

Lisp has no list type. List is an abstraction on top of the CONS cells. A CONS cell is equivalent to a node in a link list. It has two pointers; one points to data and other points to the next node or nil.

I've only covered each point superficially, but Bourguignon's post contains a lot more details.

Comments

Leave a response

Comments