You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I have customized the syntax using Antlr4 (4.13.2), but when using the parser to parse, I found that the general performance loss for each syntax parsing is about 50ms. Our project can only allow us to control it within about 5ms. I am not sure if it is because our syntax definition is inaccurate, and the performance supported by Antlr4 can only reach this limit. Can you help answer my question?(java)
`grammar DataFusion;
The grammar looks highly ambiguous and precedence looks incorrect. Use the
recognizer options to report ambiguities s you parse then fix the grammar.
Then you can use SLL mode and should teach your required parsing times
easily. You have to work at a grammar and understand it to get good
performance
Hello, I have customized the syntax using Antlr4 (4.13.2), but when using the parser to parse, I found that the general performance loss for each syntax parsing is about 50ms. Our project can only allow us to control it within about 5ms. I am not sure if it is because our syntax definition is inaccurate, and the performance supported by Antlr4 can only reach this limit. Can you help answer my question?(java)
`grammar DataFusion;
@Header{
package org.example.code;
}
options {
language = Java;
}
// DataFusion 语法定义jql
jql: elements end ;
elements: element (',' element)* ; // Simplified to allow for easier parsing of multiple elements
element: ID ':' (strings | constant | function | expr) // Simplified and removed unnecessary alternatives
| all
| ignore
;
expr: term (op=('+'|'-') term)*
| factor (op=(''|'/') factor)
| number
| strings
| function
| '(' expr ')'
;
term: factor (op=('+'|'-') factor) *;
factor: number | strings | function | '(' expr ')' | ID;
function:
AGGOPER '(' argument ')'
| IFNULL '(' number ',' strings ',' argument ')'
| CONCAT '(' strings (',' strings)* ')'
;
argument: strings | number | expr | constant
;
number: INTEGER | FLOAT
;
strings : ID
;
end : ';';
constant: ''' ID ''' | '''''' | ''' (INTEGER | FLOAT) ''';
all : ''
| ID ''
;
ignore : '-$'ID | '-$'all;
AGGOPER: 'SUM' | 'sum' | 'AVG' | 'avg' | 'COUNT' | 'count' | 'MAX' | 'max' | 'MIN' | 'min'
;
IFNULL: 'IFNULL' | 'ifnull'
;
CONCAT: 'CONCAT' | 'concat';
FLOAT : '-'? DIGIT+ '.' DIGIT+ ;
fragment DIGIT : [0-9] ;
ID : [a-zA-Z0-9_$\u0080-\uffff.]+ ;
Grammar_EOF: ';' ;
WS: [ \t\r\n]+ -> skip;`
解析耗时:57ms
The text was updated successfully, but these errors were encountered: