C PROCEDURAL SYNTAX (Compiler Builds Internal AST)
Source text → Lexer → Parser
The C Trap: In C, syntax features (operators, statement semicolons, precedence rules) are purely decorative scaffolding discarded during compilation into an internal tree you never touch.
LISP S-EXPRESSION (Code IS the AST)
Homoiconic Linked List
The Lisp Revelation: There is no syntax step. You write the AST directly as nested lists
(fn arg1 arg2). The head of every list is the operator or special form.
STEP-BY-STEP S-EXPRESSION REDUCTION TRACE
(! 4)
Lab Telemetry & Result
Final Eval Result:
24
Active Expression:
(! 4)
AST Depth:
4 levels
Homoiconic Mode:
Executable Code
Homoiconicity: The program (! 4) is parsed into a list of two symbols, identically shaped as data
C-to-Lisp Mental Model Conversions
No Precedence Hierarchy: In C,
* binds tighter than +. In Lisp, grouping is explicit via nesting: (+ 2 (* 2 3)).
Statements vs Expressions: In C,
if and while are statements returning no value. In Lisp, everything evaluates to a value.
Homoiconicity (Code = Data): A list
'(+ 1 2) is data. Strip the quote, and it executes. You can write programs that generate and rewrite programs cleanly.
Prefix Application: The first element of any non-quoted list is always the callable action:
(operator arg1 arg2 ...).