On Tuesday, 2 April 2013 at 19:00:21 UTC, Tobias Pankrath wrote:

I'm wondering if it's possibly to mechanically check that what's in the grammar is how DMD behaves.

Take the grammar and (randomly) generate strings with it and check if DMD does complain. You'd need a parse only don't check semantics flag, though.

This will not check if the strings are parsed correctly by DMD nor if invalid strings are rejected. But it would be a start.

An alternative idea for ensuring that documentation and implementation are in sync might be to list the full grammar definition as a data structure that can both be used as input for the parser and as input for a tool that generates the documentation. Theoretically possible, :) just look at Philippe Sigaud's Pegged.

Reply via email to