melt-umn / silver

An attribute grammar-based programming language for composable language extensions
http://melt.cs.umn.edu/silver/
GNU Lesser General Public License v3.0
57 stars 7 forks source link

Crash when a concrete production has a child with no concrete productions #792

Open krame505 opened 1 year ago

krame505 commented 1 year ago

If a concrete production references a nonterminal in it its signature that does not have any productions, this results in a rather unhelpful error message

Generating parser silver:compiler:composed:Default:svParse.
silver:compiler:modification:lambda_fn/Lambda.sv:49.1 [parser silver_compiler_composed_Default_svParse]: Undefined reference to silver_compiler_modification_lambda_fn_LambdaRHS
silver:compiler:modification:lambda_fn/Lambda.sv:49.1 [parser silver_compiler_composed_Default_svParse]: Undefined reference to silver_compiler_modification_lambda_fn_LambdaRHS

followed by a crash. I think that we are eliminating nonterminals with no concrete productions from the syntax AST, and this leads to undefined references in the grammar given to Copper. Instead we probably need some sort of reachability analysis on the syntax AST? Or just want to flag this as an error before trying to generate a parser?

Thought this had been fixed before, but I guess not?