# Writing a regular grammar for a regex of decimals

So I've got the regex /[1-9][0-9]*(\.[0-9]*[1-9])?/ and I'm trying to write a regular grammar for it.

I started off like this:

S ∶≔ EAB
A ∶≔ DA | ε
B ∶≔ .AE | ε
D ∶≔ 0 | 1 |  2 | 3 |  4 | 5 |  6 | 7 |  8 | 9
E ∶≔ 1 | 2 |  3 | 4 |  5 | 6 |  7 | 8 |  9


But I realised that this does not follow Chomsky's rules for regular grammars. So I was wondering how could I adapt this logic into proper notation.

Thanks!

EDIT: So below is the NDFA generated from the regex above:

• Careful: not every (programmers') regexp defines a regular language. – Raphael Apr 28 '17 at 5:08