from armchair_progamer@programming.dev to programming_languages@programming.dev on 02 May 2024 03:08
https://programming.dev/post/13531677
From the GitHub:
Cognition is a fully introspective system designed so that the syntax and hierarchy structure of the language is fully public; that is, a file that contains cognition code can alter the way that it is being parsed, in real time. Cognition allows for this because the language is completely postfix with extremely minimal syntax, and what exists of the syntax can be changed at will. Because the language never reads more than it has to, and because the language allows for metaprogramming (talking about symbols as if they are data, as well as code), the syntax of the language is made fluid. This allows for the advanced manipulation of how the next token is tokenized, and how these tokens are arranged into something like the AST without having to explicitly program a rigid syntax.
The linked post introduces Cognition and the philosophy behind it, while guiding the reader though an example Cognition program. The program starts out like gibberish, but using Cognition’s metaprogramming capabilities, gradually adopts a more readable syntax to build something useful (a Brainfuck interpreter).
threaded - newest