I am writing a simple parser (in JavaScript, and, later, in Swift) to evaluate basic arithmetic expressions such as 1+2*3
and 3*(4+5)
.
I have a working version, but I would like to test whether it is reliable.
Is there a test suite of arithmetic expressions to run through my parser?
By way of context, I am writing my own parser rather than looking for a library or using built-in functionality such as eval
. This is for the following reasons:
- Experience
- It allows me to parse expressions not normally acceptable in parsers such as
3(4+5)
,2×3
,√16
and6²
, as well as the use of special variables - Experience
Aucun commentaire:
Enregistrer un commentaire