Introduction
PHP Language Recognition Tool (phplrt) - it is a set of libraries for the development of the so-called «frontend» programming languages. After writing a grammar describing the syntax of your language, you get an abstract syntax tree.
The tool is divided into two components - a component for development, the so-called compiler-compiler (or compiler generator) and a runtime component used for parsing after the development of the language itself.
For brevity, your composer.json
file may contain lines similar to the following:
{
"require": {
"phplrt/runtime": "^3.6"
},
"require-dev": {
"phplrt/phplrt": "^3.6"
}
}
However, it should be noted that, although this is a valid, but not mandatory
option. Each library can be used separately, and the components interact
directly with each other using interfaces (using «contract»
components). For example, you might well use completely custom lexer, and use
the phplrt
as a parser only, like this:
{
"require": {
"phplrt/parser": "^3.6",
"custom/lexer": "*"
}
}