phplrt / Phplrt
Licence: mit
PHP Language Recognition Tool
Stars: ✭ 127
Programming Languages
grammar
57 projects
Projects that are alternatives of or similar to Phplrt
Snapdragon
snapdragon is an extremely pluggable, powerful and easy-to-use parser-renderer factory.
Stars: ✭ 180 (+41.73%)
Mutual labels: compiler, ast, parser
Exprtk
C++ Mathematical Expression Parsing And Evaluation Library
Stars: ✭ 301 (+137.01%)
Mutual labels: compiler, ast, parser
Tiny Compiler
A tiny compiler for a language featuring LL(2) with Lexer, Parser, ASM-like codegen and VM. Complex enough to give you a flavour of how the "real" thing works whilst not being a mere toy example
Stars: ✭ 425 (+234.65%)
Mutual labels: compiler, ast, parser
Ratel Core
High performance JavaScript to JavaScript compiler with a Rust core
Stars: ✭ 367 (+188.98%)
Mutual labels: compiler, ast, parser
Charly Vm
Fibers, Closures, C-Module System | NaN-boxing, bytecode-VM written in C++
Stars: ✭ 66 (-48.03%)
Mutual labels: compiler, ast, parser
Pyast64
Compile a subset of the Python AST to x64-64 assembler
Stars: ✭ 93 (-26.77%)
Mutual labels: compiler, ast
Libdparse
Library for lexing and parsing D source code
Stars: ✭ 91 (-28.35%)
Mutual labels: ast, parser
Rst
PHP library to parse reStructuredText documents
Stars: ✭ 90 (-29.13%)
Mutual labels: parser, library
Graphql Go Tools
Tools to write high performance GraphQL applications using Go/Golang.
Stars: ✭ 96 (-24.41%)
Mutual labels: ast, parser
Diffsitter
A tree-sitter based AST difftool to get meaningful semantic diffs
Stars: ✭ 89 (-29.92%)
Mutual labels: ast, parser
Simplepie
A simple Atom/RSS parsing library for PHP.
Stars: ✭ 1,389 (+993.7%)
Mutual labels: parser, library
Ts Transform Import Path Rewrite
TS AST transformer to rewrite import path
Stars: ✭ 104 (-18.11%)
Mutual labels: compiler, ast
I Pascal
A free Object Pascal language plugin for IntelliJ IDEA
Stars: ✭ 85 (-33.07%)
Mutual labels: ast, parser
Thanks To
![]() |
|
![]() |
|
Introduction
The phplrt is a set of tools for programming languages recognition. The library provides lexer, parser, grammar compiler, library for working with errors, text analysis and so on.
Installation
Phplrt is available as composer repository and can be installed using the following command in a root of your project:
$ composer require phplrt/phplrt
More detailed installation instructions are here.
Quick Start
<?php
use Phplrt\Compiler\Compiler;
$compiler = new Compiler();
$compiler->load(<<<EBNF
%token T_DIGIT \d
%token T_PLUS \+
%token T_MINUS \-
%token T_POW \*
%token T_DIV /
%skip T_WHITESPACE \s+
#Expression
: <T_DIGIT> (Operator() <T_DIGIT>)*
;
#Operator
: <T_PLUS>
| <T_MINUS>
| <T_POW>
| <T_DIV>
;
EBNF);
Execution
echo $compiler->parse('2 + 2');
//
// Output:
//
// <Expression offset="0">
// <T_DIGIT offset="0">2</T_DIGIT>
// <Operator offset="2">
// <T_PLUS offset="2">+</T_PLUS>
// </Operator>
// <T_DIGIT offset="4">2</T_DIGIT>
// </Expression>
//
Compilation
\file_put_contents(__DIR__ . '/grammar.php', (string)$compiler->build());
Documentation
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].