I am trying to create a lexxer and parser for a language and I'm having difficulty understanding the exact syntax when it comes to some more "robust" abstract syntax tree definitions.
The issue in question is :
fun_declaration : FUN ID param_list ':' type '{' fun_block '}'
{ M_fun ($2, [$3], $5, $7) }
fun_block : declarations fun_body { [$1] [$2] }
The definition of M_fun is as follows:
M_fun (String,[(String,Int,M_type)],M_type,[M_decl],[M_stmt])
So as you can see, $2 relates to string, $3 will return a [(String,Int,M_Type)], $5 will return an M_Type, but $7 is where the issue lies. It's to return a [M_decl], [M_stmt]. Is the above syntax correct? The happy file compiles without complaint, but when I compile the .hs file after, it explodes with ~2000 lines of errors, and I think things like this are the cause.