vanadium / issues

Vanadium issue tracker
1 stars 1 forks source link

Improve vdl parser errors (aka syntax error) #202

Open ghost opened 9 years ago

ghost commented 9 years ago

@bprosnitz writes: Currently if you do things like have imports before error declarations, you get meaningless syntax errors

@tatatodd replies: FYI, I have a plan to change the vdl parser from "go tool yacc" to a different parser that allows example-based error messages. The go yacc support yields really lame syntax errors. We're not going to make it for v0.1 though.

tatatodd commented 9 years ago

For more detail, some work has already been put into making the vdl compiler errors reasonably informative. Issues that come up for the compiler or code generators should be filed separately, and should be easy to fix.

The vdl parser is built using "go tool yacc", which has lousy error support. You basically end up with "syntax error", and if you're lucky you'll get the position in the file where the error occurred (which is itself a hacked-in feature).

We should investigate other parsers that give us better error support, or improve the core go yacc support.

Here's a parser that allows example-based error messages, which seems like a nice approach. I haven't looked into the implementation yet, I've just found it and read its docs. http://godoc.org/github.com/cznic/goyacc