I would like to define a grammar that produces and recognizes the counting numbers of the English language. I created the production rules below based on the assumption this is context-free, but I am not entirely sure thats the case. Is this a context-free or context-sensitive grammar? If context-free, do my production rules look ok?
"one hundred twenty two" $\in \Sigma^*$ which has the semantic meaning $b^2+2b^1+2b^0$
"one thousand two hundred thirty three" $\in \Sigma^*$, $b^3+2b^2+3b^1+3b^0$
I understand context-free production rules are $N \rightarrow \alpha$ and context-sensitive $\alpha N \beta \rightarrow \alpha \gamma \beta$, where $N$ is a non-terminal and $\alpha,\gamma$ are terminals or non-terminals.
I considered CFG production rules in Backus Naur Form as follows, but am unsure if it's correct:
<S> := "zero" | <b3> | <thou> | <mill> | <bill> | "" <num99> := <ones> | <teens> | <tens> | <tens> <ones> <num99opt> := <num99> | "" <b3> := <ones> "hundred" <num99opt> | <num99> <b3op> := <b3> | "" <thou> := <b3> "thousand" <b3op> <thouop> := <thou> | <b3op> <mill> := <b3> "million" <thouop> <millop>:= <mill> | <thouop> <bill> := <b3> "billion" <millop> <tens> := "twenty" | "thirty" | ... | "ninety" <teens> := "ten" | "eleven" | ... | "nineteen" <ones> := "one" | "two" | ... | "nine"