Cognition: A new antisyntax language redefining metaprogramming
A new experimental language called Cognition aims to push metaprogramming down to the level of tokenization, letting programs redefine their own syntax at runtime in a highly minimal, stack-based “antisyntax” style. Commenters are split between fascination and skepticism: some see it as a beautiful, Forth‑like research project that could change how we think about language design, while others find the bootstrapping examples unreadable, question whether it offers anything fundamentally new beyond Lisp and Racket’s reader macros, and criticize the article’s presentation and accessibility. Overall it’s viewed less as a practical tool today and more as an intriguing exploration of how far syntax flexibility can be pushed.
Initial Reactions & Overall Tone
- Many readers initially thought the project was satire (especially given the Lisp/Brainfuck framing and “line noise” examples), but several, including the author, stress it is a serious research project.
- Reactions split: some find it beautiful, enlightening, or “elementary particles” of computation; others see it as impractical, unreadable, or “joke-like art”.
Language Goals & Core Idea
- Cognition is seen as pushing metaprogramming down to the tokenization layer: user programs can redefine how text is turned into tokens and then executed, at runtime, without restarting.
- The minimal “antisyntax” bootstrap is intentional: start from almost no assumptions and build everything, including whitespace rules, from within the language.
Comparisons to Existing Systems
- Strong parallels are drawn to Forth and Factor: concatenative style, implicit stacks, bootstrapping higher-level words from tiny primitives. Some argue Cognition may just be “a new flavor of Forth”.
- Others compare it to Lisp macros, Common Lisp readtables, Racket’s reader and
#lang, Rhombus, TeX\catcode, and Unseemly. - Several Lisp-focused commenters argue that claims about Lisp’s “rigid syntax” or lack of metaprogramming generality are factually off, pointing to reader macros and powerful macro systems.
Bootstrapping, Syntax, and Readability
- The bootstrapping example is widely criticized as unreadable and off-putting, especially its dependence on whitespace and one-byte characters.
- Multiple suggestions:
- Start with a human-readable syntax and show bootstrapping later as an optional “appendix”.
- Use clearer stand‑in delimiters in explanations, better terminology for delimiters/ignore-lists, diagrams, gifs, or interactive views of the state machine and stack.
Metaprogramming Claims & Disputes
- Supporters highlight Cognition’s ability to redefine tokenization mid-stream without backtracking as possibly novel.
- Critics contend that many of the same capabilities can be achieved in Lisp, Racket, TeX, or through “STOPPARSE”-style mechanisms, and question whether Cognition is more “general” than existing minimal formalisms.
- There is back-and-forth on whether “metaprogramming = programming” and what counts as an AST or “data vs code” in Lisp.
Usefulness, Applications, and Limits
- Some see it mainly as a theoretical or artistic exploration (“because it’s there”), not something they’d want as a mainstream language.
- A few speculate about applications in AI or formal methods, but others note the examples are too opaque and not self-explanatory for practical adoption yet.