I am trying build an AST for the below grammer using ANTLR
condition_in
: column_identifier ('NOT')? 'IN' (sql_element_list | LPAREN select_stmt RPAREN)
;
for the above how do i build a rooted tree at NOT IN or IN depending upon the input ? or is there any better way ?
Also for python like dicts, how do i construct an ast, tree with MAP as root and a child MAP_PAIR for each key:value should be great i guess
map : '{' collection_element':'collection_element (',' collection_element':'collection_element)* '}'
I tried several alternatives with label and tree rewrites but antrlworks always complains
Any help would be appreciated
Try something like this: