1. Write grammar or load example into ACE editor
     simple math       NLP       self definition       ambiguity test    
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
34
35
36
37
38
39
40
41
42
{
"parent": {
"type": {"exp": "Parser"},
"subtype": {
"alternation": [
{
"type": {"exp": "OptSpaceOrComments"},
"subtype": {
"alternation": [
{
"sequence": [
{"exp": "/(\\s+)|(\\/\\/((.*\\n)|(.*$)))|(\\/\\*[\\S\\s]*?\\*\\/)/"},
{"exp": "Parser.OptSpaceOrComments"}
]
},
{"exp": "''"}
]
}
},
{
"type": {"exp": "SymbolName"},
"subtype": {"exp": "/[_A-z][_A-z0-9]*/"}
},
{
"type": {"exp": "String"},
"subtype": {
"exp": "/(\"([^\"\\\\\\n]|(\\\\[\\S\\s]))*\")|('([^'\\\\\\n]|(\\\\[\\S\\s]))*')|(`([^`\\\\]|(\\\\[\\S\\s]))*`)/"
}
},
{
"type": {"exp": "RegExp"},
"subtype": {
"exp": "/\\/(?!\\*)(?!\\/)([^\\/\\\\\\n]|(\\\\.))*\\/i?/"
}
},
{
"type": {"exp": "Root"},
"subtype": {
"type": {"exp": "AExp"},
"subtype": {
"alternation": [
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
   2. Test grammar
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/*
Network Ahead Parser self definition grammar
*/
(
Parser :> (
OptSpaceOrComments :> (
(/(\s+)|(\/\/((.*\n)|(.*$)))|(\/\*[\S\s]*?\*\/)/, OptSpaceOrComments) |
''
) |
String :> /("([^"\\\n]|(\\[\S\s]))*")|('([^'\\\n]|(\\[\S\s]))*')|(`([^`\\]|(\\[\S\s]))*`)/ |
RegExp :> /\/(?!\*)(?!\/)([^\/\\\n]|(\\.))*\/i?/ |
SymbolName :> /[_A-z][_A-z0-9]*/ |
Root :> (
AExp :> (
Alternation :> (Item :> Root.SExp, '|', Next :> Root.AExp) |
SExp :> (
Sequence :> (Item :> STExp, ',', Next :> Root.SExp) |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
     do parse       output forest  
compiling grammar... done
parsing test... done, parse time: 6ms
Successfully parsed until offset 1570 (row: 41, col: 14)
deb
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  download from Github