call trees

This commit is contained in:
2024-08-20 01:22:50 +02:00
parent 6822faaaad
commit e99549fd97
12 changed files with 914 additions and 214 deletions
+7 -2
View File
@@ -3,18 +3,23 @@ grammar Wyst;
WS: [ \t\r\n]+ -> skip; WS: [ \t\r\n]+ -> skip;
NUMBER: [1-9][0-9]* | '0'; NUMBER: [1-9][0-9]* | '0';
HEX: '0x' [a-fA-F0-9]*; HEX: '0x' [a-fA-F0-9]*;
IDENTIFIER: [a-zA-Z_] ([a-zA-Z0-9] | '::')*; IDENTIFIER: [a-zA-Z_] ([a-zA-Z0-9_] | '::')*;
MATH: '+' | '-' | '*' | '/'; MATH: '+' | '-' | '*' | '/';
fragment ESC: '\\' ['"\\] ; fragment ESC: '\\' ['"\\] ;
STRING: '"' (ESC | ~["\\])* '"'; STRING: '"' (ESC | ~["\\])* '"';
round_def: '(' (var_def (',' var_def)* ','?)? ')'; round_def: '(' (var_def (',' var_def)* ','?)? ')';
round_call: '(' (expr (',' expr)* ','?)? ')';
fn_call: IDENTIFIER round_call;
func_def: IDENTIFIER IDENTIFIER round_def code_block; func_def: IDENTIFIER IDENTIFIER round_def code_block;
var_def: IDENTIFIER IDENTIFIER; var_def: IDENTIFIER IDENTIFIER;
var_def_set: var_def '=' expr; var_def_set: var_def '=' expr;
call_tree: (fn_call|IDENTIFIER) ('.' (fn_call|IDENTIFIER))*;
asm: '%' IDENTIFIER expr (',' expr)* ';'; asm: '%' IDENTIFIER expr (',' expr)* ';';
expr: expr:
( NUMBER | (
call_tree |
NUMBER |
HEX | HEX |
IDENTIFIER | IDENTIFIER |
STRING STRING
+6 -1
View File
@@ -4,6 +4,7 @@ null
',' ','
')' ')'
'=' '='
'.'
'%' '%'
';' ';'
'{' '{'
@@ -25,6 +26,7 @@ null
null null
null null
null null
null
WS WS
NUMBER NUMBER
HEX HEX
@@ -34,9 +36,12 @@ STRING
rule names: rule names:
round_def round_def
round_call
fn_call
func_def func_def
var_def var_def
var_def_set var_def_set
call_tree
asm asm
expr expr
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, 26, 27, 1, 0, 0, 0, 27, 29, 1, 0, 0, 0, 28, 17, 1, 0, 0, 0, 28, 29, 1, 0, 0, 0, 29, 30, 1, 0, 0, 0, 30, 31, 5, 3, 0, 0, 31, 1, 1, 0, 0, 0, 32, 33, 5, 12, 0, 0, 33, 34, 5, 12, 0, 0, 34, 35, 3, 0, 0, 0, 35, 36, 3, 12, 6, 0, 36, 3, 1, 0, 0, 0, 37, 38, 5, 12, 0, 0, 38, 39, 5, 12, 0, 0, 39, 5, 1, 0, 0, 0, 40, 41, 3, 4, 2, 0, 41, 42, 5, 4, 0, 0, 42, 43, 3, 10, 5, 0, 43, 7, 1, 0, 0, 0, 44, 45, 5, 5, 0, 0, 45, 46, 5, 12, 0, 0, 46, 51, 3, 10, 5, 0, 47, 48, 5, 2, 0, 0, 48, 50, 3, 10, 5, 0, 49, 47, 1, 0, 0, 0, 50, 53, 1, 0, 0, 0, 51, 49, 1, 0, 0, 0, 51, 52, 1, 0, 0, 0, 52, 54, 1, 0, 0, 0, 53, 51, 1, 0, 0, 0, 54, 55, 5, 6, 0, 0, 55, 9, 1, 0, 0, 0, 56, 61, 7, 0, 0, 0, 57, 58, 5, 13, 0, 0, 58, 60, 3, 10, 5, 0, 59, 57, 1, 0, 0, 0, 60, 63, 1, 0, 0, 0, 61, 59, 1, 0, 0, 0, 61, 62, 1, 0, 0, 0, 62, 11, 1, 0, 0, 0, 63, 61, 1, 0, 0, 0, 64, 74, 5, 7, 0, 0, 65, 69, 3, 10, 5, 0, 66, 69, 3, 4, 2, 0, 67, 69, 3, 6, 3, 0, 68, 65, 1, 0, 0, 0, 68, 66, 1, 0, 0, 0, 68, 67, 1, 0, 0, 0, 69, 70, 1, 0, 0, 0, 70, 71, 5, 6, 0, 0, 71, 73, 1, 0, 0, 0, 72, 68, 1, 0, 0, 0, 73, 76, 1, 0, 0, 0, 74, 72, 1, 0, 0, 0, 74, 75, 1, 0, 0, 0, 75, 77, 1, 0, 0, 0, 76, 74, 1, 0, 0,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9, 121, 9, 9, 1, 9, 1, 9, 1, 10, 1, 10, 5, 10, 127, 8, 10, 10, 10, 12, 10, 130, 9, 10, 1, 10, 0, 0, 11, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 0, 0, 140, 0, 22, 1, 0, 0, 0, 2, 38, 1, 0, 0, 0, 4, 54, 1, 0, 0, 0, 6, 57, 1, 0, 0, 0, 8, 62, 1, 0, 0, 0, 10, 65, 1, 0, 0, 0, 12, 71, 1, 0, 0, 0, 14, 83, 1, 0, 0, 0, 16, 100, 1, 0, 0, 0, 18, 109, 1, 0, 0, 0, 20, 128, 1, 0, 0, 0, 22, 34, 5, 1, 0, 0, 23, 28, 3, 8, 4, 0, 24, 25, 5, 2, 0, 0, 25, 27, 3, 8, 4, 0, 26, 24, 1, 0, 0, 0, 27, 30, 1, 0, 0, 0, 28, 26, 1, 0, 0, 0, 28, 29, 1, 0, 0, 0, 29, 32, 1, 0, 0, 0, 30, 28, 1, 0, 0, 0, 31, 33, 5, 2, 0, 0, 32, 31, 1, 0, 0, 0, 32, 33, 1, 0, 0, 0, 33, 35, 1, 0, 0, 0, 34, 23, 1, 0, 0, 0, 34, 35, 1, 0, 0, 0, 35, 36, 1, 0, 0, 0, 36, 37, 5, 3, 0, 0, 37, 1, 1, 0, 0, 0, 38, 50, 5, 1, 0, 0, 39, 44, 3, 16, 8, 0, 40, 41, 5, 2, 0, 0, 41, 43, 3, 16, 8, 0, 42, 40, 1, 0, 0, 0, 43, 46, 1, 0, 0, 0, 44, 42, 1, 0, 0, 0, 44, 45, 1, 0, 0, 0, 45, 48, 1, 0, 0, 0, 46, 44, 1, 0, 0, 0, 47, 49, 5, 2, 0, 0, 48, 47, 1, 0, 0, 0, 48, 49, 1, 0, 0, 0, 49, 51, 1, 0, 0, 0, 50, 39, 1, 0, 0, 0, 50, 51, 1, 0, 0, 0, 51, 52, 1, 0, 0, 0, 52, 53, 5, 3, 0, 0, 53, 3, 1, 0, 0, 0, 54, 55, 5, 13, 0, 0, 55, 56, 3, 2, 1, 0, 56, 5, 1, 0, 0, 0, 57, 58, 5, 13, 0, 0, 58, 59, 5, 13, 0, 0, 59, 60, 3, 0, 0, 0, 60, 61, 3, 18, 9, 0, 61, 7, 1, 0, 0, 0, 62, 63, 5, 13, 0, 0, 63, 64, 5, 13, 0, 0, 64, 9, 1, 0, 0, 0, 65, 66, 3, 8, 4, 0, 66, 67, 5, 4, 0, 0, 67, 68, 3, 16, 8, 0, 68, 11, 1, 0, 0, 0, 69, 72, 3, 4, 2, 0, 70, 72, 5, 13, 0, 0, 71, 69, 1, 0, 0, 0, 71, 70, 1, 0, 0, 0, 72, 80, 1, 0, 0, 0, 73, 76, 5, 5, 0, 0, 74, 77, 3, 4, 2, 0, 75, 77, 5, 13, 0, 0, 76, 74, 1, 0, 0, 0, 76, 75, 1, 0, 0, 0, 77, 79, 1, 0, 0, 0, 78, 73, 1, 0, 0, 0, 79, 82, 1, 0, 0, 0, 80, 78, 1, 0, 0, 0, 80, 81, 1, 0, 0, 0, 81, 13, 1, 0, 0, 0, 82, 80, 1, 0, 0, 0, 83, 84, 5, 6, 0, 0, 84, 85, 5, 13, 0, 0, 85, 90, 3, 16, 8, 0, 86, 87, 5, 2, 0, 0, 87, 89, 3, 16, 8, 0, 88, 86, 1, 0, 0, 0, 89, 92, 1, 0, 0, 0, 90, 88, 1, 0, 0, 0, 90, 91, 1, 0, 0, 0, 91, 93, 1, 0, 0, 0, 92, 90, 1, 0, 0, 0, 93, 94, 5, 7, 0, 0, 94, 15, 1, 0, 0, 0, 95, 101, 3, 12, 6, 0, 96, 101, 5, 11, 0, 0, 97, 101, 5, 12, 0, 0, 98, 101, 5, 13, 0, 0, 99, 101, 5, 15, 0, 0, 100, 95, 1, 0, 0, 0, 100, 96, 1, 0, 0, 0, 100, 97, 1, 0, 0, 0, 100, 98, 1, 0, 0, 0, 100, 99, 1, 0, 0, 0, 101, 106, 1, 0, 0, 0, 102, 103, 5, 14, 0, 0, 103, 105, 3, 16, 8, 0, 104, 102, 1, 0, 0, 0, 105, 108, 1, 0, 0, 0, 106, 104, 1, 0, 0, 0, 106, 107, 1, 0, 0, 0, 107, 17, 1, 0, 0, 0, 108, 106, 1, 0, 0, 0, 109, 119, 5, 8, 0, 0, 110, 114, 3, 16, 8, 0, 111, 114, 3, 8, 4, 0, 112, 114, 3, 10, 5, 0, 113, 110, 1, 0, 0, 0, 113, 111, 1, 0, 0, 0, 113, 112, 1, 0, 0, 0, 114, 115, 1, 0, 0, 0, 115, 116, 5, 7, 0, 0, 116, 118, 1, 0, 0, 0, 117, 113, 1, 0, 0, 0, 118, 121, 1, 0, 0, 0, 119, 117, 1, 0, 0, 0, 119, 120, 1, 0, 0, 0, 120, 122, 1, 0, 0, 0, 121, 119, 1, 0, 0, 0, 122, 123, 5, 9, 0, 0, 123, 19, 1, 0, 0, 0, 124, 127, 3, 14, 7, 0, 125, 127, 3, 6, 3, 0, 126, 124, 1, 0, 0, 0, 126, 125, 1, 0, 0, 0, 127, 130, 1, 0, 0, 0, 128, 126, 1, 0, 0, 0, 128, 129, 1, 0, 0, 0, 129, 21, 1, 0, 0, 0, 130, 128, 1, 0, 0, 0, 16, 28, 32, 34, 44, 48, 50, 71, 76, 80, 90, 100, 106, 113, 119, 126, 128]
+12 -10
View File
@@ -6,17 +6,19 @@ T__4=5
T__5=6 T__5=6
T__6=7 T__6=7
T__7=8 T__7=8
WS=9 T__8=9
NUMBER=10 WS=10
HEX=11 NUMBER=11
IDENTIFIER=12 HEX=12
MATH=13 IDENTIFIER=13
STRING=14 MATH=14
STRING=15
'('=1 '('=1
','=2 ','=2
')'=3 ')'=3
'='=4 '='=4
'%'=5 '.'=5
';'=6 '%'=6
'{'=7 ';'=7
'}'=8 '{'=8
'}'=9
+4 -1
View File
@@ -4,6 +4,7 @@ null
',' ','
')' ')'
'=' '='
'.'
'%' '%'
';' ';'
'{' '{'
@@ -25,6 +26,7 @@ null
null null
null null
null null
null
WS WS
NUMBER NUMBER
HEX HEX
@@ -41,6 +43,7 @@ T__4
T__5 T__5
T__6 T__6
T__7 T__7
T__8
WS WS
NUMBER NUMBER
HEX HEX
@@ -57,4 +60,4 @@ mode names:
DEFAULT_MODE DEFAULT_MODE
atn: atn:
[4, 0, 14, 97, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 1, 0, 1, 0, 1, 1, 1, 1, 1, 2, 1, 2, 1, 3, 1, 3, 1, 4, 1, 4, 1, 5, 1, 5, 1, 6, 1, 6, 1, 7, 1, 7, 1, 8, 4, 8, 49, 8, 8, 11, 8, 12, 8, 50, 1, 8, 1, 8, 1, 9, 1, 9, 5, 9, 57, 8, 9, 10, 9, 12, 9, 60, 9, 9, 1, 9, 3, 9, 63, 8, 9, 1, 10, 1, 10, 1, 10, 1, 10, 5, 10, 69, 8, 10, 10, 10, 12, 10, 72, 9, 10, 1, 11, 1, 11, 1, 11, 1, 11, 5, 11, 78, 8, 11, 10, 11, 12, 11, 81, 9, 11, 1, 12, 1, 12, 1, 13, 1, 13, 1, 13, 1, 14, 1, 14, 1, 14, 5, 14, 91, 8, 14, 10, 14, 12, 14, 94, 9, 14, 1, 14, 1, 14, 0, 0, 15, 1, 1, 3, 2, 5, 3, 7, 4, 9, 5, 11, 6, 13, 7, 15, 8, 17, 9, 19, 10, 21, 11, 23, 12, 25, 13, 27, 0, 29, 14, 1, 0, 9, 3, 0, 9, 10, 13, 13, 32, 32, 1, 0, 49, 57, 1, 0, 48, 57, 3, 0, 48, 57, 65, 70, 97, 102, 3, 0, 65, 90, 95, 95, 97, 122, 3, 0, 48, 57, 65, 90, 97, 122, 3, 0, 42, 43, 45, 45, 47, 47, 3, 0, 34, 34, 39, 39, 92, 92, 2,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0, 57, 60, 1, 0, 0, 0, 58, 56, 1, 0, 0, 0, 58, 59, 1, 0, 0, 0, 59, 63, 1, 0, 0, 0, 60, 58, 1, 0, 0, 0, 61, 63, 5, 48, 0, 0, 62, 54, 1, 0, 0, 0, 62, 61, 1, 0, 0, 0, 63, 20, 1, 0, 0, 0, 64, 65, 5, 48, 0, 0, 65, 66, 5, 120, 0, 0, 66, 70, 1, 0, 0, 0, 67, 69, 7, 3, 0, 0, 68, 67, 1, 0, 0, 0, 69, 72, 1, 0, 0, 0, 70, 68, 1, 0, 0, 0, 70, 71, 1, 0, 0, 0, 71, 22, 1, 0, 0, 0, 72, 70, 1, 0, 0, 0, 73, 79, 7, 4, 0, 0, 74, 78, 7, 5, 0, 0, 75, 76, 5, 58, 0, 0, 76, 78, 5, 58, 0, 0, 77, 74, 1, 0, 0, 0, 77, 75, 1, 0, 0, 0, 78, 81, 1, 0, 0, 0, 79, 77, 1, 0, 0, 0, 79, 80, 1, 0, 0, 0, 80, 24, 1, 0, 0, 0, 81, 79, 1, 0, 0, 0, 82, 83, 7, 6, 0, 0, 83, 26, 1, 0, 0, 0, 84, 85, 5, 92, 0, 0, 85, 86, 7, 7, 0, 0, 86, 28, 1, 0, 0, 0, 87, 92, 5, 34, 0, 0, 88, 91, 3, 27, 13, 0, 89, 91, 8, 8, 0, 0, 90, 88, 1, 0, 0, 0, 90, 89, 1, 0, 0, 0, 91, 94, 1, 0, 0, 0, 92, 90, 1, 0, 0, 0, 92, 93, 1, 0, 0, 0, 93, 95, 1, 0, 0, 0, 94, 92, 1, 0, 0, 0, 95, 96, 5, 34, 0, 0, 96, 30, 1, 0, 0, 0, 9, 0, 50, 58, 62, 70, 77, 79, 90, 92, 1, 6, 0, 0] [4, 0, 15, 101, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 1, 0, 1, 0, 1, 1, 1, 1, 1, 2, 1, 2, 1, 3, 1, 3, 1, 4, 1, 4, 1, 5, 1, 5, 1, 6, 1, 6, 1, 7, 1, 7, 1, 8, 1, 8, 1, 9, 4, 9, 53, 8, 9, 11, 9, 12, 9, 54, 1, 9, 1, 9, 1, 10, 1, 10, 5, 10, 61, 8, 10, 10, 10, 12, 10, 64, 9, 10, 1, 10, 3, 10, 67, 8, 10, 1, 11, 1, 11, 1, 11, 1, 11, 5, 11, 73, 8, 11, 10, 11, 12, 11, 76, 9, 11, 1, 12, 1, 12, 1, 12, 1, 12, 5, 12, 82, 8, 12, 10, 12, 12, 12, 85, 9, 12, 1, 13, 1, 13, 1, 14, 1, 14, 1, 14, 1, 15, 1, 15, 1, 15, 5, 15, 95, 8, 15, 10, 15, 12, 15, 98, 9, 15, 1, 15, 1, 15, 0, 0, 16, 1, 1, 3, 2, 5, 3, 7, 4, 9, 5, 11, 6, 13, 7, 15, 8, 17, 9, 19, 10, 21, 11, 23, 12, 25, 13, 27, 14, 29, 0, 31, 15, 1, 0, 9, 3, 0, 9, 10, 13, 13, 32, 32, 1, 0, 49, 57, 1, 0, 48, 57, 3, 0, 48, 57, 65, 70, 97, 102, 3, 0, 65, 90, 95, 95, 97, 122, 4, 0, 48, 57, 65, 90, 95, 95, 97, 122, 3, 0, 42, 43, 45, 45, 47, 47, 3, 0, 34, 34, 39, 39, 92, 92, 2, 0, 34, 34, 92, 92, 107, 0, 1, 1, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 5, 1, 0, 0, 0, 0, 7, 1, 0, 0, 0, 0, 9, 1, 0, 0, 0, 0, 11, 1, 0, 0, 0, 0, 13, 1, 0, 0, 0, 0, 15, 1, 0, 0, 0, 0, 17, 1, 0, 0, 0, 0, 19, 1, 0, 0, 0, 0, 21, 1, 0, 0, 0, 0, 23, 1, 0, 0, 0, 0, 25, 1, 0, 0, 0, 0, 27, 1, 0, 0, 0, 0, 31, 1, 0, 0, 0, 1, 33, 1, 0, 0, 0, 3, 35, 1, 0, 0, 0, 5, 37, 1, 0, 0, 0, 7, 39, 1, 0, 0, 0, 9, 41, 1, 0, 0, 0, 11, 43, 1, 0, 0, 0, 13, 45, 1, 0, 0, 0, 15, 47, 1, 0, 0, 0, 17, 49, 1, 0, 0, 0, 19, 52, 1, 0, 0, 0, 21, 66, 1, 0, 0, 0, 23, 68, 1, 0, 0, 0, 25, 77, 1, 0, 0, 0, 27, 86, 1, 0, 0, 0, 29, 88, 1, 0, 0, 0, 31, 91, 1, 0, 0, 0, 33, 34, 5, 40, 0, 0, 34, 2, 1, 0, 0, 0, 35, 36, 5, 44, 0, 0, 36, 4, 1, 0, 0, 0, 37, 38, 5, 41, 0, 0, 38, 6, 1, 0, 0, 0, 39, 40, 5, 61, 0, 0, 40, 8, 1, 0, 0, 0, 41, 42, 5, 46, 0, 0, 42, 10, 1, 0, 0, 0, 43, 44, 5, 37, 0, 0, 44, 12, 1, 0, 0, 0, 45, 46, 5, 59, 0, 0, 46, 14, 1, 0, 0, 0, 47, 48, 5, 123, 0, 0, 48, 16, 1, 0, 0, 0, 49, 50, 5, 125, 0, 0, 50, 18, 1, 0, 0, 0, 51, 53, 7, 0, 0, 0, 52, 51, 1, 0, 0, 0, 53, 54, 1, 0, 0, 0, 54, 52, 1, 0, 0, 0, 54, 55, 1, 0, 0, 0, 55, 56, 1, 0, 0, 0, 56, 57, 6, 9, 0, 0, 57, 20, 1, 0, 0, 0, 58, 62, 7, 1, 0, 0, 59, 61, 7, 2, 0, 0, 60, 59, 1, 0, 0, 0, 61, 64, 1, 0, 0, 0, 62, 60, 1, 0, 0, 0, 62, 63, 1, 0, 0, 0, 63, 67, 1, 0, 0, 0, 64, 62, 1, 0, 0, 0, 65, 67, 5, 48, 0, 0, 66, 58, 1, 0, 0, 0, 66, 65, 1, 0, 0, 0, 67, 22, 1, 0, 0, 0, 68, 69, 5, 48, 0, 0, 69, 70, 5, 120, 0, 0, 70, 74, 1, 0, 0, 0, 71, 73, 7, 3, 0, 0, 72, 71, 1, 0, 0, 0, 73, 76, 1, 0, 0, 0, 74, 72, 1, 0, 0, 0, 74, 75, 1, 0, 0, 0, 75, 24, 1, 0, 0, 0, 76, 74, 1, 0, 0, 0, 77, 83, 7, 4, 0, 0, 78, 82, 7, 5, 0, 0, 79, 80, 5, 58, 0, 0, 80, 82, 5, 58, 0, 0, 81, 78, 1, 0, 0, 0, 81, 79, 1, 0, 0, 0, 82, 85, 1, 0, 0, 0, 83, 81, 1, 0, 0, 0, 83, 84, 1, 0, 0, 0, 84, 26, 1, 0, 0, 0, 85, 83, 1, 0, 0, 0, 86, 87, 7, 6, 0, 0, 87, 28, 1, 0, 0, 0, 88, 89, 5, 92, 0, 0, 89, 90, 7, 7, 0, 0, 90, 30, 1, 0, 0, 0, 91, 96, 5, 34, 0, 0, 92, 95, 3, 29, 14, 0, 93, 95, 8, 8, 0, 0, 94, 92, 1, 0, 0, 0, 94, 93, 1, 0, 0, 0, 95, 98, 1, 0, 0, 0, 96, 94, 1, 0, 0, 0, 96, 97, 1, 0, 0, 0, 97, 99, 1, 0, 0, 0, 98, 96, 1, 0, 0, 0, 99, 100, 5, 34, 0, 0, 100, 32, 1, 0, 0, 0, 9, 0, 54, 62, 66, 74, 81, 83, 94, 96, 1, 6, 0, 0]
+12 -10
View File
@@ -6,17 +6,19 @@ T__4=5
T__5=6 T__5=6
T__6=7 T__6=7
T__7=8 T__7=8
WS=9 T__8=9
NUMBER=10 WS=10
HEX=11 NUMBER=11
IDENTIFIER=12 HEX=12
MATH=13 IDENTIFIER=13
STRING=14 MATH=14
STRING=15
'('=1 '('=1
','=2 ','=2
')'=3 ')'=3
'='=4 '='=4
'%'=5 '.'=5
';'=6 '%'=6
'{'=7 ';'=7
'}'=8 '{'=8
'}'=9
+18
View File
@@ -27,6 +27,18 @@ func (s *BaseWystListener) EnterRound_def(ctx *Round_defContext) {}
// ExitRound_def is called when production round_def is exited. // ExitRound_def is called when production round_def is exited.
func (s *BaseWystListener) ExitRound_def(ctx *Round_defContext) {} func (s *BaseWystListener) ExitRound_def(ctx *Round_defContext) {}
// EnterRound_call is called when production round_call is entered.
func (s *BaseWystListener) EnterRound_call(ctx *Round_callContext) {}
// ExitRound_call is called when production round_call is exited.
func (s *BaseWystListener) ExitRound_call(ctx *Round_callContext) {}
// EnterFn_call is called when production fn_call is entered.
func (s *BaseWystListener) EnterFn_call(ctx *Fn_callContext) {}
// ExitFn_call is called when production fn_call is exited.
func (s *BaseWystListener) ExitFn_call(ctx *Fn_callContext) {}
// EnterFunc_def is called when production func_def is entered. // EnterFunc_def is called when production func_def is entered.
func (s *BaseWystListener) EnterFunc_def(ctx *Func_defContext) {} func (s *BaseWystListener) EnterFunc_def(ctx *Func_defContext) {}
@@ -45,6 +57,12 @@ func (s *BaseWystListener) EnterVar_def_set(ctx *Var_def_setContext) {}
// ExitVar_def_set is called when production var_def_set is exited. // ExitVar_def_set is called when production var_def_set is exited.
func (s *BaseWystListener) ExitVar_def_set(ctx *Var_def_setContext) {} func (s *BaseWystListener) ExitVar_def_set(ctx *Var_def_setContext) {}
// EnterCall_tree is called when production call_tree is entered.
func (s *BaseWystListener) EnterCall_tree(ctx *Call_treeContext) {}
// ExitCall_tree is called when production call_tree is exited.
func (s *BaseWystListener) ExitCall_tree(ctx *Call_treeContext) {}
// EnterAsm is called when production asm is entered. // EnterAsm is called when production asm is entered.
func (s *BaseWystListener) EnterAsm(ctx *AsmContext) {} func (s *BaseWystListener) EnterAsm(ctx *AsmContext) {}
+56 -53
View File
@@ -43,62 +43,64 @@ func wystlexerLexerInit() {
"DEFAULT_MODE", "DEFAULT_MODE",
} }
staticData.LiteralNames = []string{ staticData.LiteralNames = []string{
"", "'('", "','", "')'", "'='", "'%'", "';'", "'{'", "'}'", "", "'('", "','", "')'", "'='", "'.'", "'%'", "';'", "'{'", "'}'",
} }
staticData.SymbolicNames = []string{ staticData.SymbolicNames = []string{
"", "", "", "", "", "", "", "", "", "WS", "NUMBER", "HEX", "IDENTIFIER", "", "", "", "", "", "", "", "", "", "", "WS", "NUMBER", "HEX", "IDENTIFIER",
"MATH", "STRING", "MATH", "STRING",
} }
staticData.RuleNames = []string{ staticData.RuleNames = []string{
"T__0", "T__1", "T__2", "T__3", "T__4", "T__5", "T__6", "T__7", "WS", "T__0", "T__1", "T__2", "T__3", "T__4", "T__5", "T__6", "T__7", "T__8",
"NUMBER", "HEX", "IDENTIFIER", "MATH", "ESC", "STRING", "WS", "NUMBER", "HEX", "IDENTIFIER", "MATH", "ESC", "STRING",
} }
staticData.PredictionContextCache = antlr.NewPredictionContextCache() staticData.PredictionContextCache = antlr.NewPredictionContextCache()
staticData.serializedATN = []int32{ staticData.serializedATN = []int32{
4, 0, 14, 97, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 0, 15, 101, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2,
4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2,
10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 1, 0, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15,
1, 0, 1, 1, 1, 1, 1, 2, 1, 2, 1, 3, 1, 3, 1, 4, 1, 4, 1, 5, 1, 5, 1, 6, 7, 15, 1, 0, 1, 0, 1, 1, 1, 1, 1, 2, 1, 2, 1, 3, 1, 3, 1, 4, 1, 4, 1, 5,
1, 6, 1, 7, 1, 7, 1, 8, 4, 8, 49, 8, 8, 11, 8, 12, 8, 50, 1, 8, 1, 8, 1, 1, 5, 1, 6, 1, 6, 1, 7, 1, 7, 1, 8, 1, 8, 1, 9, 4, 9, 53, 8, 9, 11, 9,
9, 1, 9, 5, 9, 57, 8, 9, 10, 9, 12, 9, 60, 9, 9, 1, 9, 3, 9, 63, 8, 9, 12, 9, 54, 1, 9, 1, 9, 1, 10, 1, 10, 5, 10, 61, 8, 10, 10, 10, 12, 10,
1, 10, 1, 10, 1, 10, 1, 10, 5, 10, 69, 8, 10, 10, 10, 12, 10, 72, 9, 10, 64, 9, 10, 1, 10, 3, 10, 67, 8, 10, 1, 11, 1, 11, 1, 11, 1, 11, 5, 11,
1, 11, 1, 11, 1, 11, 1, 11, 5, 11, 78, 8, 11, 10, 11, 12, 11, 81, 9, 11, 73, 8, 11, 10, 11, 12, 11, 76, 9, 11, 1, 12, 1, 12, 1, 12, 1, 12, 5, 12,
1, 12, 1, 12, 1, 13, 1, 13, 1, 13, 1, 14, 1, 14, 1, 14, 5, 14, 91, 8, 14, 82, 8, 12, 10, 12, 12, 12, 85, 9, 12, 1, 13, 1, 13, 1, 14, 1, 14, 1, 14,
10, 14, 12, 14, 94, 9, 14, 1, 14, 1, 14, 0, 0, 15, 1, 1, 3, 2, 5, 3, 7, 1, 15, 1, 15, 1, 15, 5, 15, 95, 8, 15, 10, 15, 12, 15, 98, 9, 15, 1, 15,
4, 9, 5, 11, 6, 13, 7, 15, 8, 17, 9, 19, 10, 21, 11, 23, 12, 25, 13, 27, 1, 15, 0, 0, 16, 1, 1, 3, 2, 5, 3, 7, 4, 9, 5, 11, 6, 13, 7, 15, 8, 17,
0, 29, 14, 1, 0, 9, 3, 0, 9, 10, 13, 13, 32, 32, 1, 0, 49, 57, 1, 0, 48, 9, 19, 10, 21, 11, 23, 12, 25, 13, 27, 14, 29, 0, 31, 15, 1, 0, 9, 3, 0,
57, 3, 0, 48, 57, 65, 70, 97, 102, 3, 0, 65, 90, 95, 95, 97, 122, 3, 0, 9, 10, 13, 13, 32, 32, 1, 0, 49, 57, 1, 0, 48, 57, 3, 0, 48, 57, 65, 70,
48, 57, 65, 90, 97, 122, 3, 0, 42, 43, 45, 45, 47, 47, 3, 0, 34, 34, 39, 97, 102, 3, 0, 65, 90, 95, 95, 97, 122, 4, 0, 48, 57, 65, 90, 95, 95, 97,
39, 92, 92, 2, 0, 34, 34, 92, 92, 103, 0, 1, 1, 0, 0, 0, 0, 3, 1, 0, 0, 122, 3, 0, 42, 43, 45, 45, 47, 47, 3, 0, 34, 34, 39, 39, 92, 92, 2, 0,
0, 0, 5, 1, 0, 0, 0, 0, 7, 1, 0, 0, 0, 0, 9, 1, 0, 0, 0, 0, 11, 1, 0, 0, 34, 34, 92, 92, 107, 0, 1, 1, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 5, 1, 0, 0,
0, 0, 13, 1, 0, 0, 0, 0, 15, 1, 0, 0, 0, 0, 17, 1, 0, 0, 0, 0, 19, 1, 0, 0, 0, 7, 1, 0, 0, 0, 0, 9, 1, 0, 0, 0, 0, 11, 1, 0, 0, 0, 0, 13, 1, 0,
0, 0, 0, 21, 1, 0, 0, 0, 0, 23, 1, 0, 0, 0, 0, 25, 1, 0, 0, 0, 0, 29, 1, 0, 0, 0, 15, 1, 0, 0, 0, 0, 17, 1, 0, 0, 0, 0, 19, 1, 0, 0, 0, 0, 21, 1,
0, 0, 0, 1, 31, 1, 0, 0, 0, 3, 33, 1, 0, 0, 0, 5, 35, 1, 0, 0, 0, 7, 37, 0, 0, 0, 0, 23, 1, 0, 0, 0, 0, 25, 1, 0, 0, 0, 0, 27, 1, 0, 0, 0, 0, 31,
1, 0, 0, 0, 9, 39, 1, 0, 0, 0, 11, 41, 1, 0, 0, 0, 13, 43, 1, 0, 0, 0, 1, 0, 0, 0, 1, 33, 1, 0, 0, 0, 3, 35, 1, 0, 0, 0, 5, 37, 1, 0, 0, 0, 7,
15, 45, 1, 0, 0, 0, 17, 48, 1, 0, 0, 0, 19, 62, 1, 0, 0, 0, 21, 64, 1, 39, 1, 0, 0, 0, 9, 41, 1, 0, 0, 0, 11, 43, 1, 0, 0, 0, 13, 45, 1, 0, 0,
0, 0, 0, 23, 73, 1, 0, 0, 0, 25, 82, 1, 0, 0, 0, 27, 84, 1, 0, 0, 0, 29, 0, 15, 47, 1, 0, 0, 0, 17, 49, 1, 0, 0, 0, 19, 52, 1, 0, 0, 0, 21, 66,
87, 1, 0, 0, 0, 31, 32, 5, 40, 0, 0, 32, 2, 1, 0, 0, 0, 33, 34, 5, 44, 1, 0, 0, 0, 23, 68, 1, 0, 0, 0, 25, 77, 1, 0, 0, 0, 27, 86, 1, 0, 0, 0,
0, 0, 34, 4, 1, 0, 0, 0, 35, 36, 5, 41, 0, 0, 36, 6, 1, 0, 0, 0, 37, 38, 29, 88, 1, 0, 0, 0, 31, 91, 1, 0, 0, 0, 33, 34, 5, 40, 0, 0, 34, 2, 1,
5, 61, 0, 0, 38, 8, 1, 0, 0, 0, 39, 40, 5, 37, 0, 0, 40, 10, 1, 0, 0, 0, 0, 0, 0, 35, 36, 5, 44, 0, 0, 36, 4, 1, 0, 0, 0, 37, 38, 5, 41, 0, 0, 38,
41, 42, 5, 59, 0, 0, 42, 12, 1, 0, 0, 0, 43, 44, 5, 123, 0, 0, 44, 14, 6, 1, 0, 0, 0, 39, 40, 5, 61, 0, 0, 40, 8, 1, 0, 0, 0, 41, 42, 5, 46, 0,
1, 0, 0, 0, 45, 46, 5, 125, 0, 0, 46, 16, 1, 0, 0, 0, 47, 49, 7, 0, 0, 0, 42, 10, 1, 0, 0, 0, 43, 44, 5, 37, 0, 0, 44, 12, 1, 0, 0, 0, 45, 46,
0, 48, 47, 1, 0, 0, 0, 49, 50, 1, 0, 0, 0, 50, 48, 1, 0, 0, 0, 50, 51, 5, 59, 0, 0, 46, 14, 1, 0, 0, 0, 47, 48, 5, 123, 0, 0, 48, 16, 1, 0, 0,
1, 0, 0, 0, 51, 52, 1, 0, 0, 0, 52, 53, 6, 8, 0, 0, 53, 18, 1, 0, 0, 0, 0, 49, 50, 5, 125, 0, 0, 50, 18, 1, 0, 0, 0, 51, 53, 7, 0, 0, 0, 52, 51,
54, 58, 7, 1, 0, 0, 55, 57, 7, 2, 0, 0, 56, 55, 1, 0, 0, 0, 57, 60, 1, 1, 0, 0, 0, 53, 54, 1, 0, 0, 0, 54, 52, 1, 0, 0, 0, 54, 55, 1, 0, 0, 0,
0, 0, 0, 58, 56, 1, 0, 0, 0, 58, 59, 1, 0, 0, 0, 59, 63, 1, 0, 0, 0, 60, 55, 56, 1, 0, 0, 0, 56, 57, 6, 9, 0, 0, 57, 20, 1, 0, 0, 0, 58, 62, 7,
58, 1, 0, 0, 0, 61, 63, 5, 48, 0, 0, 62, 54, 1, 0, 0, 0, 62, 61, 1, 0, 1, 0, 0, 59, 61, 7, 2, 0, 0, 60, 59, 1, 0, 0, 0, 61, 64, 1, 0, 0, 0, 62,
0, 0, 63, 20, 1, 0, 0, 0, 64, 65, 5, 48, 0, 0, 65, 66, 5, 120, 0, 0, 66, 60, 1, 0, 0, 0, 62, 63, 1, 0, 0, 0, 63, 67, 1, 0, 0, 0, 64, 62, 1, 0, 0,
70, 1, 0, 0, 0, 67, 69, 7, 3, 0, 0, 68, 67, 1, 0, 0, 0, 69, 72, 1, 0, 0, 0, 65, 67, 5, 48, 0, 0, 66, 58, 1, 0, 0, 0, 66, 65, 1, 0, 0, 0, 67, 22,
0, 70, 68, 1, 0, 0, 0, 70, 71, 1, 0, 0, 0, 71, 22, 1, 0, 0, 0, 72, 70, 1, 0, 0, 0, 68, 69, 5, 48, 0, 0, 69, 70, 5, 120, 0, 0, 70, 74, 1, 0, 0,
1, 0, 0, 0, 73, 79, 7, 4, 0, 0, 74, 78, 7, 5, 0, 0, 75, 76, 5, 58, 0, 0, 0, 71, 73, 7, 3, 0, 0, 72, 71, 1, 0, 0, 0, 73, 76, 1, 0, 0, 0, 74, 72,
76, 78, 5, 58, 0, 0, 77, 74, 1, 0, 0, 0, 77, 75, 1, 0, 0, 0, 78, 81, 1, 1, 0, 0, 0, 74, 75, 1, 0, 0, 0, 75, 24, 1, 0, 0, 0, 76, 74, 1, 0, 0, 0,
0, 0, 0, 79, 77, 1, 0, 0, 0, 79, 80, 1, 0, 0, 0, 80, 24, 1, 0, 0, 0, 81, 77, 83, 7, 4, 0, 0, 78, 82, 7, 5, 0, 0, 79, 80, 5, 58, 0, 0, 80, 82, 5,
79, 1, 0, 0, 0, 82, 83, 7, 6, 0, 0, 83, 26, 1, 0, 0, 0, 84, 85, 5, 92, 58, 0, 0, 81, 78, 1, 0, 0, 0, 81, 79, 1, 0, 0, 0, 82, 85, 1, 0, 0, 0, 83,
0, 0, 85, 86, 7, 7, 0, 0, 86, 28, 1, 0, 0, 0, 87, 92, 5, 34, 0, 0, 88, 81, 1, 0, 0, 0, 83, 84, 1, 0, 0, 0, 84, 26, 1, 0, 0, 0, 85, 83, 1, 0, 0,
91, 3, 27, 13, 0, 89, 91, 8, 8, 0, 0, 90, 88, 1, 0, 0, 0, 90, 89, 1, 0, 0, 86, 87, 7, 6, 0, 0, 87, 28, 1, 0, 0, 0, 88, 89, 5, 92, 0, 0, 89, 90,
0, 0, 91, 94, 1, 0, 0, 0, 92, 90, 1, 0, 0, 0, 92, 93, 1, 0, 0, 0, 93, 95, 7, 7, 0, 0, 90, 30, 1, 0, 0, 0, 91, 96, 5, 34, 0, 0, 92, 95, 3, 29, 14,
1, 0, 0, 0, 94, 92, 1, 0, 0, 0, 95, 96, 5, 34, 0, 0, 96, 30, 1, 0, 0, 0, 0, 93, 95, 8, 8, 0, 0, 94, 92, 1, 0, 0, 0, 94, 93, 1, 0, 0, 0, 95, 98,
9, 0, 50, 58, 62, 70, 77, 79, 90, 92, 1, 6, 0, 0, 1, 0, 0, 0, 96, 94, 1, 0, 0, 0, 96, 97, 1, 0, 0, 0, 97, 99, 1, 0, 0, 0,
98, 96, 1, 0, 0, 0, 99, 100, 5, 34, 0, 0, 100, 32, 1, 0, 0, 0, 9, 0, 54,
62, 66, 74, 81, 83, 94, 96, 1, 6, 0, 0,
} }
deserializer := antlr.NewATNDeserializer(nil) deserializer := antlr.NewATNDeserializer(nil)
staticData.atn = deserializer.Deserialize(staticData.serializedATN) staticData.atn = deserializer.Deserialize(staticData.serializedATN)
@@ -147,10 +149,11 @@ const (
WystLexerT__5 = 6 WystLexerT__5 = 6
WystLexerT__6 = 7 WystLexerT__6 = 7
WystLexerT__7 = 8 WystLexerT__7 = 8
WystLexerWS = 9 WystLexerT__8 = 9
WystLexerNUMBER = 10 WystLexerWS = 10
WystLexerHEX = 11 WystLexerNUMBER = 11
WystLexerIDENTIFIER = 12 WystLexerHEX = 12
WystLexerMATH = 13 WystLexerIDENTIFIER = 13
WystLexerSTRING = 14 WystLexerMATH = 14
WystLexerSTRING = 15
) )
+18
View File
@@ -11,6 +11,12 @@ type WystListener interface {
// EnterRound_def is called when entering the round_def production. // EnterRound_def is called when entering the round_def production.
EnterRound_def(c *Round_defContext) EnterRound_def(c *Round_defContext)
// EnterRound_call is called when entering the round_call production.
EnterRound_call(c *Round_callContext)
// EnterFn_call is called when entering the fn_call production.
EnterFn_call(c *Fn_callContext)
// EnterFunc_def is called when entering the func_def production. // EnterFunc_def is called when entering the func_def production.
EnterFunc_def(c *Func_defContext) EnterFunc_def(c *Func_defContext)
@@ -20,6 +26,9 @@ type WystListener interface {
// EnterVar_def_set is called when entering the var_def_set production. // EnterVar_def_set is called when entering the var_def_set production.
EnterVar_def_set(c *Var_def_setContext) EnterVar_def_set(c *Var_def_setContext)
// EnterCall_tree is called when entering the call_tree production.
EnterCall_tree(c *Call_treeContext)
// EnterAsm is called when entering the asm production. // EnterAsm is called when entering the asm production.
EnterAsm(c *AsmContext) EnterAsm(c *AsmContext)
@@ -35,6 +44,12 @@ type WystListener interface {
// ExitRound_def is called when exiting the round_def production. // ExitRound_def is called when exiting the round_def production.
ExitRound_def(c *Round_defContext) ExitRound_def(c *Round_defContext)
// ExitRound_call is called when exiting the round_call production.
ExitRound_call(c *Round_callContext)
// ExitFn_call is called when exiting the fn_call production.
ExitFn_call(c *Fn_callContext)
// ExitFunc_def is called when exiting the func_def production. // ExitFunc_def is called when exiting the func_def production.
ExitFunc_def(c *Func_defContext) ExitFunc_def(c *Func_defContext)
@@ -44,6 +59,9 @@ type WystListener interface {
// ExitVar_def_set is called when exiting the var_def_set production. // ExitVar_def_set is called when exiting the var_def_set production.
ExitVar_def_set(c *Var_def_setContext) ExitVar_def_set(c *Var_def_setContext)
// ExitCall_tree is called when exiting the call_tree production.
ExitCall_tree(c *Call_treeContext)
// ExitAsm is called when exiting the asm production. // ExitAsm is called when exiting the asm production.
ExitAsm(c *AsmContext) ExitAsm(c *AsmContext)
+756 -128
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -37,7 +37,7 @@ func ConvertAST(node antlr.Tree, wparser *parser.WystParser, lexer *parser.WystL
} }
for i := 0; i < node.GetChildCount(); i++ { for i := 0; i < node.GetChildCount(); i++ {
l := ConvertAST(node.GetChild(i), wparser, lexer) l := ConvertAST(node.GetChild(i), wparser, lexer)
if l.Rule != ("'"+l.Text+"'") || l.Text == ";" { if l.Rule != ("'"+l.Text+"'") || l.Text == ";" || l.Text == "," {
ast.Inner = append(ast.Inner, l) ast.Inner = append(ast.Inner, l)
} }
} }
+19 -6
View File
@@ -29,6 +29,7 @@ func TranspileToken(node ASTNode) string {
res += fmt.Sprintf("%x", c) res += fmt.Sprintf("%x", c)
} }
} }
res = strings.ReplaceAll(res, "::", "::_0x")
case "HEX": case "HEX":
res += node.Text res += node.Text
case "MATH": case "MATH":
@@ -37,6 +38,8 @@ func TranspileToken(node ASTNode) string {
res += node.Text res += node.Text
case "';'": case "';'":
res += "\n " res += "\n "
case "','":
res += ", "
default: default:
fmt.Printf("\x1b[33mDEV NOTICE:\x1b[0m Missing token case for '%s'\n", node.Rule) fmt.Printf("\x1b[33mDEV NOTICE:\x1b[0m Missing token case for '%s'\n", node.Rule)
@@ -57,19 +60,29 @@ func TranspileNode(node ASTNode) string {
case "expr": case "expr":
res += TranspileNodes(node.Inner) res += TranspileNodes(node.Inner)
case "code_block": case "code_block":
res += "{\n " res += fmt.Sprintf("{\n %s}", strings.TrimSuffix(TranspileNodes(node.Inner), " "))
res += strings.TrimSuffix(TranspileNodes(node.Inner), " ")
res += "}\n"
case "var_def": case "var_def":
res += fmt.Sprintf("var %s %s", TranspileNode(node.Inner[1]), TranspileNode(node.Inner[0])) res += fmt.Sprintf("var %s %s", TranspileNode(node.Inner[1]), TranspileNode(node.Inner[0]))
case "round_def": case "round_def":
res += "(" fmt.Sprintf("(%s)", strings.TrimSuffix(strings.ReplaceAll(TranspileNodes(node.Inner), "var ", ""), " "))
res += strings.TrimSuffix(strings.ReplaceAll(TranspileNodes(node.Inner), "var ", ""), " ")
res += ")"
case "asm": case "asm":
if node.Inner[0].Text == "map" && len(node.Inner) == 4 { if node.Inner[0].Text == "map" && len(node.Inner) == 4 {
wyst_map = append(wyst_map, wmap{node.Inner[1].Text, node.Inner[2].Text}) wyst_map = append(wyst_map, wmap{node.Inner[1].Text, node.Inner[2].Text})
} }
case "call_tree":
for i, c := range node.Inner {
res += TranspileNode(c)
if i+1 < len(node.Inner) {
res += "."
}
}
case "fn_call":
res += TranspileNode(node.Inner[0])
res += TranspileNode(node.Inner[1])
case "round_call":
res += fmt.Sprintf("(%s)", TranspileNodes(node.Inner))
default: default:
fmt.Printf("\x1b[33mDEV NOTICE:\x1b[0m Missing case for '%s'\n", node.Rule) fmt.Printf("\x1b[33mDEV NOTICE:\x1b[0m Missing case for '%s'\n", node.Rule)
+5 -2
View File
@@ -1,2 +1,5 @@
%map test, hi; %map _, _;
int main(test x) {}
int main(test x) {
x::h.y.z(0, "test");
}