Today I added some syntax to the NOM arithmetic expression parser which takes an arithmetic infix expression such as:
4.2*(3+(x*y))
and produces output in lisp format as follows:
(* 4.2 (+ 3 (* x y)))
The script parses the expression and reformats it as a LISP expression (lots of brackets). This is a fairly basic parsing problem which cannot be solved with regular expressions One of the reasons that it is not possible with regex's is that the expression may contain nested pairs of brackets. If there is “nesting", then you need, at least,” context-free languages or patterns.
It took me a couple of hours to add signed decimal numbers, powers and +/- signs to the grammar. I don't know if that is slow or fast, but the coding seemed quite straightforward.
Since then I have created a much more powerful expression parser called eg/maths.parse.pss which has good error checking and a built in help system.
Enough for now.