tree-sitter/docs/section-2-architecture.md
2018-06-10 14:44:33 -07:00

1,017 B

title permalink
Architecture architecture

Architecture

Tree-sitter consists of two separate libraries, both of which expose C APIs.

The first library, libcompiler, is used to generate a parser for a language by supplying a context-free grammar describing the language. libcompiler is a build tool; once the parser has been generated, it is no longer needed. Its public interface is specified in the header file compiler.h.

The second library, libruntime, is used in combination with the parsers generated by libcompiler, to produce syntax trees from source code and keep the syntax trees up-to-date as the source code changes. libruntime is designed to be embedded in applications. Its interface is specified in the header file runtime.h.

The Compiler