Expressif.Syntax provides the Tree-sitter parser for the Expressif expression language, together with bindings for supported programming languages.
The parser defines the concrete syntax of Expressif independently from its runtime implementations. It is intended to provide a common syntax foundation for the C#, Python and TypeScript implementations of Expressif, as well as editor tooling and language-server support.
About | Repository structure | Development
Expressif.Syntax separates the syntax of the Expressif language from its runtime semantics.
The Tree-sitter grammar parses source text into a syntax tree while preserving syntactic constructs such as shorthands. Language-specific bindings can then translate this tree into the semantic representation expected by an Expressif implementation.
For example:
.foo
is represented syntactically as a field-access construct, while:
field(foo)
is represented as a regular function call. Both can later be bound to the same semantic operation:
field(foo)
This separation allows the same parser to support:
- Expressif for C#
- Expressif for Python
- Expressif for TypeScript
- language servers
- syntax highlighting and other editor tooling
.
├── grammar.js
├── tree-sitter.json
├── package.json
├── src/
│ ├── parser.c
│ ├── grammar.json
│ └── node-types.json
├── bindings/
│ ├── csharp/
│ ├── python/
│ └── typescript/
├── queries/
│ └── highlights.scm
└── test/
grammar.js is the source definition of the Expressif grammar.
The files under src/ are generated by Tree-sitter and are committed to source control so consumers do not need the Tree-sitter CLI to build the parser.
Language-specific integration is located under bindings/.
Install the dependencies:
npm installGenerate the parser:
npx tree-sitter generateRun the grammar tests:
npx tree-sitter testThe grammar should remain independent from the Expressif function catalogue. Parsing determines the syntactic structure of an expression; resolution of functions, predicates, accumulators and their accepted arguments belongs to the language-specific semantic binding layer.
- Expressif — C# implementation and reference project
- Expressif documentation — language documentation