I've been working on a little expression parser over the weekend. Given an input string in the format
it will produce a floating-point value (10 in this case). The internal number cruncher is BBC BASIC's FPP
(so you would need BBC BASIC installed) and so all the features of BBC BASIC's FPP are provided either in the form of a function or an operator. The syntax is vaguely C-like with a few functions (min
) turned into operators (<?
) and a few additional operators (\
for integer division, >>>
for an unsigned right shift).
I suspect the technique is more useful than the implementation (especially given the dependency on BBC BASIC), so would anyone find it useful if I wrote this up?
Edit: Apparently not. Here's an archive of the source
with some documentation.