Write a BNF grammar for a new language called 4040. It should
include the following rules:
- Variable definitions should start with var.
- There must be only single space after var.
- Variable names should come after the var and single space.
- Variable names should start with a letter or underscore(_).
Starting with a digit is not allowed.
- Variable names can have digits after the first letter.
- There can be multiple variable names separated by comma.
Between variables, spaces are allowed.
- There should be double colon (::) right after the variable
name. Space(s) should be allowed.
- Right after the double colon, the data type should be
identified as integer, string, boolean or double.
Some input examples:
var myStr:: string
var b:: boolean
var myfloat:: double
var a, b, c:: integer