1. Go to this page and download the library: Download ryangjchandler/lexical library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
ryangjchandler / lexical example snippets
enum TokenType
{
case Number;
case Add;
case Subtract;
case Multiply;
case Divide;
}
enum TokenType
{
#[Regex("[0-9]+")]
case Number;
#[Literal("+")]
case Add;
#[Literal("-")]
case Subtract;
#[Literal("*")]
case Multiply;
#[Literal("/")]
case Divide;
}
$lexer = (new LexicalBuilder)
->readTokenTypesFrom(TokenType::class)
->build();