1. Go to this page and download the library: Download edin/lexicon 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/ */
#[OneOf([
GroupedExpressionNode::class,
NumberNode::class,
])]
interface PrimaryExpressionNode extends ExpressionNode
{
}
#[Terminal(MathToken::Number)]
final readonly class NumberNode implements PrimaryExpressionNode
{
public function __construct(public Token $token)
{
}
}
#[Fold(
operators: [MathToken::Plus, MathToken::Minus],
operand: TermNode::class
)]
final readonly class ExpressionNode
{
public function __construct(
public Token $operator,
public Node $left,
public Node $right
) {
}
}