24 lines
1 KiB
Markdown
24 lines
1 KiB
Markdown
---
|
|
title: Architecture
|
|
permalink: 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](https://en.wikipedia.org/wiki/Context-free_grammar) describing the
|
|
language. `libcompiler` is a build tool; it is no longer needed once a parser has been generated. Its public interface is specified in the header file [`compiler.h`](https://github.com/tree-sitter/tree-sitter/blob/master/include/tree_sitter/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`](https://github.com/tree-sitter/tree-sitter/blob/master/include/tree_sitter/runtime.h).
|
|
|
|
## The Compiler
|
|
|
|
WIP
|
|
|
|
## The Runtime
|
|
|
|
WIP
|