Grammar construction in ply - recursion allowed?
问题 This has maybe been asked before but I do not know what to search for, really. Suppose I have some string I'd like to build a parser with. I have strings like a OR b , b OR C but also a OR (b AND c) . Now the nested parentheses cause trouble for me and I don't know how to construct the appropriate p_* functions. Is recursion allowed? If so, how? This is what I have thus far: import ply.lex as lex import ply.yacc as yacc # List of token names. This is always required tokens = ( 'VARIABLE', 'OR