I apologize for my very basic question but, I'm really struggling here. I need to make a recursive descent parser. I'm working in Python and using PLY. My grammar follows:
< list > → (< sequence >) | ()
< sequence > → < listelement > , < sequence > | < listelement >
< listelement > → < list > | NUMBER
Would that look something like this? Am I way off? The end goal is to read a list into a data structure and then print it out.
def p_list(p)
'list : "("sequence")" | "("")"'
def p_sequence(p)
'sequence : list_el","sequence | list_el'
def p_list_el(p)
'list_el : list | NUMBER'
If anyone was wondering what the full solution was I'll post it shortly.
NUMBERdoes require defining.