Download the PHP package dbeurive/shuntingyard without Composer
On this page you can find all versions of the php package dbeurive/shuntingyard. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download dbeurive/shuntingyard
More information about dbeurive/shuntingyard
Files in dbeurive/shuntingyard
Package shuntingyard
Short Description This is an implementation of the shunting yard algorithm.
License MIT
Informations about the package shuntingyard
Introduction
This repository contains an implementation of the Shunting Yard algorithm.
Installation
From the command line:
composer require dbeurive\shuntingyard
If you want to include this package to your project, then edit your file composer.json
and add the following entry:
"require": {
"dbeurive/shuntingyard": "*"
}
Synopsis
The result:
"azerty" / V1 + V2 * sin(10):
STRING "azerty"
VARIABLE V1
OPERATOR /
VARIABLE V2
NUMERIC 10
FUNCTION sin
OPERATOR *
OPERATOR +
Configuration
The algorithm is configured by:
- The list of tokens (see the documentation for the class dbeurive\Lexer\Lexer).
- The operators' precedencies.
- The operators' associativities.
- The list of tokens' types that represents variables.
- The list of tokens' types that represents functions.
- The list of tokens' types that represents operators.
- The token's type that represents the parameters separator.
- The token's type that represents the start of a list of parameters (typically "(").
- The token's type that represents the end of a list of parameters (typically ")").
WARNING
Make sure to double all characters "
\
" within the regular expressions that define the tokens. That is:'/\s/'
becomes'/\\s/'.
Be aware that the order of declarations of the tokens is important (see the documentation for the class dbeurive\Lexer\Lexer)).
The synopsis should be clear enough. You can also consult the example.