M-expression
In Lisp programming language, M-expressions (or meta-expressions) were an early proposed syntax for the Lisp, inspired by contemporary languages such as Fortran and ALGOL. The notation was never implemented into the language and, as such, it was never finalized.
In Lisp programming language, M-expressions (or meta-expressions) were an early proposed syntax for the Lisp, inspired by contemporary languages such as Fortran and ALGOL. The notation was never implemented into the language and, as such, it was never finalized. ==Background== John McCarthy published the first paper on Lisp in 1960 while a research fellow at the Massachusetts Institute of Technology. In it he described a language of symbolic expressions (S-expressions) that could represent complex structures as lists. Then he defined a set of primitive operations on the S-expressions, and a language of meta-expressions (M-expressions) that could be used to define more complex operations. Finally, he showed how the meta-language itself could be represented with S-expressions, resulting in a system that was potentially self-hosting. The draft version of this paper is known as "AI Memo 8". McCarthy had planned to develop an automatic Lisp compiler (LISP 2) using M-expressions as the language syntax and S-expressions to describe the compiler's internal processes. Stephen R. Russell read the paper and suggested to him that S-expressions were a more convenient syntax. Although McCarthy disapproved of the idea, Russell and colleague Daniel J. Edwards hand-coded an interpreter program that could execute S-expressions. This program was adopted by McCarthy's research group, establishing S-expressions as the dominant form of Lisp. McCarthy reflected on the fate of M-expressions in 1979: The book Anatomy of LISP by John Allen explains the definition of M-expressions and uses them throughout the book to explain Lisp and its implementation. apply[fn;x;a] = [atom[fn] → [eq[fn;CAR] → caar[x]; eq[fn;CDR] → cdar[x]; eq[fn;CONS] → cons[car[x];cadr[x ; eq[fn;ATOM] → atom[car[x ; eq[fn;EQ] → eq[car[x];cadr[x ; T → apply[eval[fn;a];x;a ; eq[car[fn];LAMBDA] → eval[caddr[fn];parlis[cadr[fn];x;a ; eq[car[fn];LABEL] → apply[caddr[fn];x;cons[cons[cadr[fn];caddr[fn ;a ] eval[e;a] = [atom[e] → cdr[assoc[e;a ; atom[car[e → [eq[car[e],QUOTE] → cadr[e]; eq[car[e];COND] → evcon[cdr[e];a]; T → apply[car[e];evlis[cdr[e];a];a ; T → apply[car[e];evlis[cdr[e];a];a Using the function eval on an s-expression. eval[(EQ (QUOTE A) (CAR (CONS (QUOTE A) (QUOTE (B C D)))));NIL] ==Further development== A CGOL (1977) was implemented in MacLisp and follows a similar goal of introducing Algol-like syntax with infix operators. It is known to work on Armed Bear Common Lisp. A more recent (circa 2003) variant is the I-expression, which use indentation to indicate parentheses implicitly, and are thus in some ways intermediate between S-expressions and M-expressions. I-expressions were introduced in Scheme Request For Implementation 49 as an auxiliary syntax for Scheme, but they have not been widely adopted. A further development is the "sweet" t-expression, which has infix operators without precedence. Like I-expressions, t-expressions are only a simple transformation away from S-expressions, so that theoretically they can be used on any Lisp dialect and not interfere with features like macros. Additional syntax-related include Apple's Dylan (Algol-like tokens) and Clojure's addition of other literal syntaxes. ==Notes== ==References==
References
- ^ "The implementation of LISP" . www-formal.stanford.edu . Retrieved 2020-03-29 . Wikipedia revision 1362049904, retrieved 2026-11-22 · 1585436400.0
- ^ Möller, Egil (2003). "SRFI 49: Indentation-sensitive syntax" . srfi.schemers.org . Wikipedia revision 1362049904, retrieved 2026-11-22 · 1795302000.0
- ^ Wheeler, DA (2013). "SRFI 110: Sweet-expressions (t-expressions)" . srfi.schemers.org . Wikipedia revision 1362049904, retrieved 2026-11-22 · 1795302000.0
- ^ McCarthy, John (March 1959). "Recursive Functions of Symbolic Expressions and Their Computation by Machine (AI Memo 8)" . Archived from the original on 7 March 2021. Wikipedia revision 1362049904, retrieved 2026-11-22 · 1795302000.0
- ^ "The implementation of LISP" . Formal.stanford.edu. 1979-02-12 . Retrieved 2013-08-24 . Wikipedia revision 1362049904, retrieved 2026-11-22 · 1377298800.0
- ^ "A Parser for M-Expressions" . Archived from the original on 24 March 2021. Let's newbies play with them, and realize how impractical they are. Note for example, that we cannot use macros anymore because their syntax would need to be known by the M-expression parser. Wikipedia revision 1362049904, retrieved 2026-11-22 · 1795302000.0
- ^ "Anatomy of LISP" . McGraw-Hill, Inc. 1978. Wikipedia revision 1362049904, retrieved 2026-11-22 · 1795302000.0
- ^ a b "LISP 1.5 Programmer's Manual" (PDF) . Community.computerhistory.org. 1965. Archived from the original (PDF) on 2006-02-11 . Retrieved 2013-09-02 . Wikipedia revision 1362049904, retrieved 2026-11-22 · 1378076400.0
- ^ CGOL on ABCL Development of the Armed Bear Common Lisp implementation blog. Wikipedia revision 1362049904, retrieved 2026-11-22 · 1795302000.0
- ^ McCarthy, John (April 1960) "Recursive Functions of Symbolic Expressions and Their Computation by Machine, Part I" Wikipedia revision 1362049904, retrieved 2026-11-22 · 1795302000.0
- ^ a b c Lee, Xah. "LISP Infix Syntax Survey" . Wikipedia revision 1362049904, retrieved 2026-11-22 · 1795302000.0
- Wikipedia “M-expression” revision 1362049904 · retrieved 2026-10-20 publication date (×1) · confidence 0.95 revision URL · 1792450800.0
Cite this
"M-expression". 1782919167. e01 Encyclopedia. CC BY-SA 4.0. https://en.wikipedia.org/w/index.php?oldid=1362049904 JSON record · API collection · BibTeX · RIS · CSL-JSON · citation policy