using a grammar to parse and validate a form in Python, PHP, JavaScript