build grammer

This commit is contained in:
Daniel Martinek
2026-03-30 23:41:14 +02:00
parent c5f58e4ece
commit f970a12053
9 changed files with 3202 additions and 2877 deletions
+1 -1
View File
@@ -168,7 +168,7 @@ func1:
| ERODE LPAREN expr (COMMA expr)? RPAREN # ErodeFunc
| MORPH_OPEN LPAREN expr (COMMA expr)? RPAREN # MorphOpenFunc
| MORPH_CLOSE LPAREN expr (COMMA expr)? RPAREN # MorphCloseFunc
| INT LPAREN expr RPAREN # IntFunc;
| INT LPAREN expr RPAREN # IntFunc
| FLOAT LPAREN expr RPAREN # FloatFunc;
func2:
File diff suppressed because one or more lines are too long
+158 -150
View File
@@ -105,94 +105,98 @@ CLEAR=104
HAS=105
GET=106
CONCAT=107
UPPER=108
LOWER=109
TRIM=110
SPLIT=111
JOIN=112
SUBSTRING=113
SUBSTR=114
FIND=115
REPLACE=116
DILATE=117
ERODE=118
MORPH_OPEN=119
MORPH_CLOSE=120
RGB_TO_HSV=121
HSV_TO_RGB=122
IF=123
ELSE=124
WHILE=125
FOR=126
IN=127
BREAK=128
CONTINUE=129
RETURN=130
TIMESTAMP=131
SORT=132
ARGSORT=133
ARGMIN=134
ARGMAX=135
SOFTMAX=136
SOFTMIN=137
UNIQUE=138
FLIP=139
COV=140
CORR=141
ENTROPY=142
CROP=143
NONE=144
NOISE=145
RAND=146
CAUCHY=147
EXPONENTIAL=148
LOGNORMAL=149
BERNOULLI=150
POISSON=151
GAMMADIST=152
BETADIST=153
LAPLACEDIST=154
GUMBELDIST=155
WEIBULLDIST=156
CHI2DIST=157
STUDENTTDIST=158
PERLIN=159
CELLULAR=160
PLASMA=161
PLUS=162
MINUS=163
MULT=164
DIV=165
MOD=166
POW=167
LSHIFT=168
RSHIFT=169
GE=170
GT=171
LE=172
LT=173
EQ=174
EQUEALS=175
NE=176
PIPE=177
LPAREN=178
RPAREN=179
COMMA=180
SEMICOLON=181
ARROW=182
LBRACKET=183
RBRACKET=184
QUESTION=185
COLON=186
LBRACE=187
RBRACE=188
NUMBER=189
CONSTANT=190
STRING=191
VARIABLE=192
SL_COMMENT=193
ML_COMMENT=194
WS=195
INT=108
FLOAT=109
UPPER=110
LOWER=111
TRIM=112
SPLIT=113
JOIN=114
SUBSTRING=115
SUBSTR=116
FIND=117
REPLACE=118
DILATE=119
ERODE=120
MORPH_OPEN=121
MORPH_CLOSE=122
RGB_TO_HSV=123
HSV_TO_RGB=124
INT_TO_RGB=125
RGB_TO_INT=126
IF=127
ELSE=128
WHILE=129
FOR=130
IN=131
BREAK=132
CONTINUE=133
RETURN=134
TIMESTAMP=135
SORT=136
ARGSORT=137
ARGMIN=138
ARGMAX=139
SOFTMAX=140
SOFTMIN=141
UNIQUE=142
FLIP=143
COV=144
CORR=145
ENTROPY=146
CROP=147
NONE=148
NOISE=149
RAND=150
CAUCHY=151
EXPONENTIAL=152
LOGNORMAL=153
BERNOULLI=154
POISSON=155
GAMMADIST=156
BETADIST=157
LAPLACEDIST=158
GUMBELDIST=159
WEIBULLDIST=160
CHI2DIST=161
STUDENTTDIST=162
PERLIN=163
CELLULAR=164
PLASMA=165
PLUS=166
MINUS=167
MULT=168
DIV=169
MOD=170
POW=171
LSHIFT=172
RSHIFT=173
GE=174
GT=175
LE=176
LT=177
EQ=178
EQUEALS=179
NE=180
PIPE=181
LPAREN=182
RPAREN=183
COMMA=184
SEMICOLON=185
ARROW=186
LBRACKET=187
RBRACKET=188
QUESTION=189
COLON=190
LBRACE=191
RBRACE=192
NUMBER=193
CONSTANT=194
STRING=195
VARIABLE=196
SL_COMMENT=197
ML_COMMENT=198
WS=199
'sin'=1
'cos'=2
'tan'=3
@@ -276,65 +280,69 @@ WS=195
'stack_clear'=104
'stack_has'=105
'stack_get'=106
'upper'=108
'lower'=109
'trim'=110
'split'=111
'join'=112
'substring'=113
'substr'=114
'find'=115
'replace'=116
'dilate'=117
'erode'=118
'morph_open'=119
'morph_close'=120
'rgb_to_hsv'=121
'hsv_to_rgb'=122
'if'=123
'else'=124
'while'=125
'for'=126
'in'=127
'break'=128
'continue'=129
'return'=130
'timestamp'=131
'sort'=132
'argsort'=133
'argmin'=134
'argmax'=135
'softmax'=136
'softmin'=137
'unique'=138
'flip'=139
'cov'=140
'entropy'=142
'crop'=143
'+'=162
'-'=163
'*'=164
'/'=165
'%'=166
'^'=167
'<<'=168
'>>'=169
'>='=170
'>'=171
'<='=172
'<'=173
'=='=174
'='=175
'!='=176
'|'=177
'('=178
')'=179
','=180
';'=181
'->'=182
'['=183
']'=184
'?'=185
':'=186
'{'=187
'}'=188
'int'=108
'float'=109
'upper'=110
'lower'=111
'trim'=112
'split'=113
'join'=114
'substring'=115
'substr'=116
'find'=117
'replace'=118
'dilate'=119
'erode'=120
'morph_open'=121
'morph_close'=122
'rgb_to_hsv'=123
'hsv_to_rgb'=124
'int_to_rgb'=125
'rgb_to_int'=126
'if'=127
'else'=128
'while'=129
'for'=130
'in'=131
'break'=132
'continue'=133
'return'=134
'timestamp'=135
'sort'=136
'argsort'=137
'argmin'=138
'argmax'=139
'softmax'=140
'softmin'=141
'unique'=142
'flip'=143
'cov'=144
'entropy'=146
'crop'=147
'+'=166
'-'=167
'*'=168
'/'=169
'%'=170
'^'=171
'<<'=172
'>>'=173
'>='=174
'>'=175
'<='=176
'<'=177
'=='=178
'='=179
'!='=180
'|'=181
'('=182
')'=183
','=184
';'=185
'->'=186
'['=187
']'=188
'?'=189
':'=190
'{'=191
'}'=192
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
+158 -150
View File
@@ -105,94 +105,98 @@ CLEAR=104
HAS=105
GET=106
CONCAT=107
UPPER=108
LOWER=109
TRIM=110
SPLIT=111
JOIN=112
SUBSTRING=113
SUBSTR=114
FIND=115
REPLACE=116
DILATE=117
ERODE=118
MORPH_OPEN=119
MORPH_CLOSE=120
RGB_TO_HSV=121
HSV_TO_RGB=122
IF=123
ELSE=124
WHILE=125
FOR=126
IN=127
BREAK=128
CONTINUE=129
RETURN=130
TIMESTAMP=131
SORT=132
ARGSORT=133
ARGMIN=134
ARGMAX=135
SOFTMAX=136
SOFTMIN=137
UNIQUE=138
FLIP=139
COV=140
CORR=141
ENTROPY=142
CROP=143
NONE=144
NOISE=145
RAND=146
CAUCHY=147
EXPONENTIAL=148
LOGNORMAL=149
BERNOULLI=150
POISSON=151
GAMMADIST=152
BETADIST=153
LAPLACEDIST=154
GUMBELDIST=155
WEIBULLDIST=156
CHI2DIST=157
STUDENTTDIST=158
PERLIN=159
CELLULAR=160
PLASMA=161
PLUS=162
MINUS=163
MULT=164
DIV=165
MOD=166
POW=167
LSHIFT=168
RSHIFT=169
GE=170
GT=171
LE=172
LT=173
EQ=174
EQUEALS=175
NE=176
PIPE=177
LPAREN=178
RPAREN=179
COMMA=180
SEMICOLON=181
ARROW=182
LBRACKET=183
RBRACKET=184
QUESTION=185
COLON=186
LBRACE=187
RBRACE=188
NUMBER=189
CONSTANT=190
STRING=191
VARIABLE=192
SL_COMMENT=193
ML_COMMENT=194
WS=195
INT=108
FLOAT=109
UPPER=110
LOWER=111
TRIM=112
SPLIT=113
JOIN=114
SUBSTRING=115
SUBSTR=116
FIND=117
REPLACE=118
DILATE=119
ERODE=120
MORPH_OPEN=121
MORPH_CLOSE=122
RGB_TO_HSV=123
HSV_TO_RGB=124
INT_TO_RGB=125
RGB_TO_INT=126
IF=127
ELSE=128
WHILE=129
FOR=130
IN=131
BREAK=132
CONTINUE=133
RETURN=134
TIMESTAMP=135
SORT=136
ARGSORT=137
ARGMIN=138
ARGMAX=139
SOFTMAX=140
SOFTMIN=141
UNIQUE=142
FLIP=143
COV=144
CORR=145
ENTROPY=146
CROP=147
NONE=148
NOISE=149
RAND=150
CAUCHY=151
EXPONENTIAL=152
LOGNORMAL=153
BERNOULLI=154
POISSON=155
GAMMADIST=156
BETADIST=157
LAPLACEDIST=158
GUMBELDIST=159
WEIBULLDIST=160
CHI2DIST=161
STUDENTTDIST=162
PERLIN=163
CELLULAR=164
PLASMA=165
PLUS=166
MINUS=167
MULT=168
DIV=169
MOD=170
POW=171
LSHIFT=172
RSHIFT=173
GE=174
GT=175
LE=176
LT=177
EQ=178
EQUEALS=179
NE=180
PIPE=181
LPAREN=182
RPAREN=183
COMMA=184
SEMICOLON=185
ARROW=186
LBRACKET=187
RBRACKET=188
QUESTION=189
COLON=190
LBRACE=191
RBRACE=192
NUMBER=193
CONSTANT=194
STRING=195
VARIABLE=196
SL_COMMENT=197
ML_COMMENT=198
WS=199
'sin'=1
'cos'=2
'tan'=3
@@ -276,65 +280,69 @@ WS=195
'stack_clear'=104
'stack_has'=105
'stack_get'=106
'upper'=108
'lower'=109
'trim'=110
'split'=111
'join'=112
'substring'=113
'substr'=114
'find'=115
'replace'=116
'dilate'=117
'erode'=118
'morph_open'=119
'morph_close'=120
'rgb_to_hsv'=121
'hsv_to_rgb'=122
'if'=123
'else'=124
'while'=125
'for'=126
'in'=127
'break'=128
'continue'=129
'return'=130
'timestamp'=131
'sort'=132
'argsort'=133
'argmin'=134
'argmax'=135
'softmax'=136
'softmin'=137
'unique'=138
'flip'=139
'cov'=140
'entropy'=142
'crop'=143
'+'=162
'-'=163
'*'=164
'/'=165
'%'=166
'^'=167
'<<'=168
'>>'=169
'>='=170
'>'=171
'<='=172
'<'=173
'=='=174
'='=175
'!='=176
'|'=177
'('=178
')'=179
','=180
';'=181
'->'=182
'['=183
']'=184
'?'=185
':'=186
'{'=187
'}'=188
'int'=108
'float'=109
'upper'=110
'lower'=111
'trim'=112
'split'=113
'join'=114
'substring'=115
'substr'=116
'find'=117
'replace'=118
'dilate'=119
'erode'=120
'morph_open'=121
'morph_close'=122
'rgb_to_hsv'=123
'hsv_to_rgb'=124
'int_to_rgb'=125
'rgb_to_int'=126
'if'=127
'else'=128
'while'=129
'for'=130
'in'=131
'break'=132
'continue'=133
'return'=134
'timestamp'=135
'sort'=136
'argsort'=137
'argmin'=138
'argmax'=139
'softmax'=140
'softmin'=141
'unique'=142
'flip'=143
'cov'=144
'entropy'=146
'crop'=147
'+'=166
'-'=167
'*'=168
'/'=169
'%'=170
'^'=171
'<<'=172
'>>'=173
'>='=174
'>'=175
'<='=176
'<'=177
'=='=178
'='=179
'!='=180
'|'=181
'('=182
')'=183
','=184
';'=185
'->'=186
'['=187
']'=188
'?'=189
':'=190
'{'=191
'}'=192
+36
View File
@@ -1250,6 +1250,24 @@ class MathExprListener(ParseTreeListener):
pass
# Enter a parse tree produced by MathExprParser#IntFunc.
def enterIntFunc(self, ctx:MathExprParser.IntFuncContext):
pass
# Exit a parse tree produced by MathExprParser#IntFunc.
def exitIntFunc(self, ctx:MathExprParser.IntFuncContext):
pass
# Enter a parse tree produced by MathExprParser#FloatFunc.
def enterFloatFunc(self, ctx:MathExprParser.FloatFuncContext):
pass
# Exit a parse tree produced by MathExprParser#FloatFunc.
def exitFloatFunc(self, ctx:MathExprParser.FloatFuncContext):
pass
# Enter a parse tree produced by MathExprParser#PowFunc.
def enterPowFunc(self, ctx:MathExprParser.PowFuncContext):
pass
@@ -1574,6 +1592,24 @@ class MathExprListener(ParseTreeListener):
pass
# Enter a parse tree produced by MathExprParser#Int_to_rgbFunc.
def enterInt_to_rgbFunc(self, ctx:MathExprParser.Int_to_rgbFuncContext):
pass
# Exit a parse tree produced by MathExprParser#Int_to_rgbFunc.
def exitInt_to_rgbFunc(self, ctx:MathExprParser.Int_to_rgbFuncContext):
pass
# Enter a parse tree produced by MathExprParser#Rgb_to_intFunc.
def enterRgb_to_intFunc(self, ctx:MathExprParser.Rgb_to_intFuncContext):
pass
# Exit a parse tree produced by MathExprParser#Rgb_to_intFunc.
def exitRgb_to_intFunc(self, ctx:MathExprParser.Rgb_to_intFuncContext):
pass
# Enter a parse tree produced by MathExprParser#ClampFunc.
def enterClampFunc(self, ctx:MathExprParser.ClampFuncContext):
pass
File diff suppressed because it is too large Load Diff
+20
View File
@@ -699,6 +699,16 @@ class MathExprVisitor(ParseTreeVisitor):
return self.visitChildren(ctx)
# Visit a parse tree produced by MathExprParser#IntFunc.
def visitIntFunc(self, ctx:MathExprParser.IntFuncContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by MathExprParser#FloatFunc.
def visitFloatFunc(self, ctx:MathExprParser.FloatFuncContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by MathExprParser#PowFunc.
def visitPowFunc(self, ctx:MathExprParser.PowFuncContext):
return self.visitChildren(ctx)
@@ -879,6 +889,16 @@ class MathExprVisitor(ParseTreeVisitor):
return self.visitChildren(ctx)
# Visit a parse tree produced by MathExprParser#Int_to_rgbFunc.
def visitInt_to_rgbFunc(self, ctx:MathExprParser.Int_to_rgbFuncContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by MathExprParser#Rgb_to_intFunc.
def visitRgb_to_intFunc(self, ctx:MathExprParser.Rgb_to_intFuncContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by MathExprParser#ClampFunc.
def visitClampFunc(self, ctx:MathExprParser.ClampFuncContext):
return self.visitChildren(ctx)