printfn / fend

Arbitrary-precision unit-aware calculator
https://printfn.github.io/fend
MIT License
586 stars 50 forks source link

Converting `fend` scripts to `bc`/`dc` syntax for portable scripts #190

Open Alhadis opened 1 year ago

Alhadis commented 1 year ago

Not sure how doable this would be, but it'd be nice to have some way of converting a fend script to bc or dc syntax (chiefly for embedding within a portable shell-script designed to run on systems that don't have fend installed).

printfn commented 1 year ago

I haven't actually used bc/dc before, but this definitely sounds like it'd be a cool and useful feature to have.

Alhadis commented 1 year ago

I recommend starting with bc, as its syntax is the easiest to learn and use in everyday practice. dc uses Reverse Polish Notation and is a concatenative stack-based programming language that's literally older than C (it's one of the oldest surviving Unix commands, IIRC). bc can even compile to dc syntax, so the former is probably worth targeting first.