LangProc / langproc-2017-lab

4 stars 8 forks source link

Fractions #71

Open HarryAnkers opened 6 years ago

HarryAnkers commented 6 years ago

You mention numbers "may have a fractional part", do you want this to be implemented using a divide or is the number class suppose to have a function where it self-evaluates it after lexing?

edpickup commented 6 years ago

If you look in src/maths_lexer.flex you see that T_NUMBER can have a decimal followed by 0 or more numbers. If you then look in include/ast/ast_primitives.hpp that a "number" is basically a double with some extra wrapping.

My interpretation of all that is a a valid number will be of the form 234 or 234. or 234.5 etc, and that the lexer / parser is happy to handle non integer values. Ie "fractional part" is represented in decimal form, I think.