Reputation: 13
I use TatSu as a python parser library (as intended) and used the "CalcMiniTutorial" to help to understand the buildup.
Sadly I don't find a solution to declare float numbers.
The tutorial uses number = /\d+/ ;
for normal numbers but that wont work for Floats.
I also tried number = /\d+"."\d+/ ;
and number = /\d+\\.\d+/ ;
but that wont work ether.
Does someone have an idea or solution?
Upvotes: 0
Views: 98
Reputation: 9244
The definitions for number
are not working because the regular expressions are incorrect (and that has nothing to do with TatSu).
You can use a site like https://pythex.org to test your regular expressions, and modify them until you get the expected result.
Once you get the basic regex right, think about the different forms of floats you'd like to have in the language.
Upvotes: 1