Skip to content
 
 

Repository files navigation

Expressif.Syntax

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

About

Project: Expressif Tree-sitter

Releases: GitHub Release GitHub Release Date licence badge

Dev. activity: GitHub last commit Still maintained GitHub commit activity

Status: stars badge Bugs badge Features badge

Purpose

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

Repository structure

.
├── 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/.

Development

Install the dependencies:

npm install

Generate the parser:

npx tree-sitter generate

Run the grammar tests:

npx tree-sitter test

The 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.

Related projects

About

Parser and language bindings for the Expressif language.

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages