2 ms·
It excludes languages that build a single AST directly from tokens. I am pretty sure Clang is like this, and probably v8. (They don't have structured macros,
by chubot 2y ago
It excludes languages that build a single AST directly from tokens. I am pretty sure Clang is like this, and probably v8. (They don't have structured macros, so it's not observable by users.)
As opposed to building first an untyped CST (concrete syntax tree), and then transforming that into a typed AST.
CPython does exactly this, but it has no macro stage either, so it's not exposed to users. (Python/ast.c is the CST -> AST transformation. It transforms an untyped tree to a typed tree.)
So the key reason it matters is that it's a place to insert the macro stage.
---
I agree that the word "bicameral" is confusing people, but it basically means "reader --> parser" as opposed to just "parser".
The analogies in the article are very clear to me -- in this world, JSON and XML parsers are "readers", but they are NOT "parsers"! (and yes that probably confuses many people, some new words could be necessary)
The JSON Schema or XML Schema would be closer to the parser -- it determines whether you have a "for loop" or "if statement", or an "employee" and "job title", etc.
Another clarifying comment - https://lobste.rs/s/ici6ek/bicameral_not_homoiconic#c_bmx0vf https://lobste.rs/s/ici6ek/bicameral_not_homoiconic#c_bmx0vf
- chubot 2y agoI'll also argue that the ideas in this post absolutely matter in practice. For example, Github Actions uses YAML as its Reader / S-expression / CST layer. And then it has a separate "parser", for say "if" nodes, and then another parser for the string value of those "if" nodes. https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#jobsjob_idif https://docs.github.com/en/actions/writing-workflows/workflo... if: ${{ ! startsWith(github.ref, 'refs/tags/') }} if: github.repository == 'octo-org/octo-repo-prod' This fact is poorly exposed to users: You must always use the ${{ }} expression syntax or escape with '', "", or () when the expression starts with !, since ! is reserved notation in YAML format. So I feel that they could have done a better job with language design by taking some lessons from the past. Gitlab has the same kind of hacky language on top of YAML as far as I remember