-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex2.php
33 lines (29 loc) · 915 Bytes
/
index2.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
require 'vendor/autoload.php';
use Tyson\Tokens;
use Tyson\Tokenizer;
use Tyson\Generator;
$rules = [
Tokens::T_NUMBER => '\d+',
Tokens::T_WHITESPACE => '\s+',
Tokens::T_CLASS => 'class',
Tokens::T_NAMESPACE => 'namespace',
Tokens::T_PRIVATE => 'private',
Tokens::T_PROTECTED => 'protected',
Tokens::T_PUBLIC => 'public',
Tokens::T_FUNCTION => 'function',
Tokens::T_TRUE => 'true',
Tokens::T_FALSE => 'false',
Tokens::T_NULL => 'null',
Tokens::T_IDENTIFIER => "[\_a-zA-Z][\_a-zA-Z0-9]*",
Tokens::T_SEMICOLON => ";",
Tokens::T_LBRACKET => "{",
Tokens::T_RBRACKET => "}",
Tokens::T_EQUALS => "=",
Tokens::T_LPAREN => '\(',
Tokens::T_RPAREN => '\)',
Tokens::T_ADD => '\+',
Tokens::T_SUBTRACT => '\-',
];
$generator = new Generator();
$generator->load("ebnf.json");