bespoke: finish grammar specification and rudimentary check of validity

Signed-off-by: Peter Williams <pwil3058@gmail.com>