# aced: calculator&ed implemented in awk // 24-10-27
As a small project to better learn awk, and to get something
useful out of it, I've started [aced][1]:
using Awk for implementing a Calculator (in RPN) combined
with an ED clone.
Since some time, I've wanted to get better in awk, and as my
[wrapdc][2] script recently has become buggy on FreeBSD (I'm
suspecting some subtle changes in its dc implementation), I
wanted to write an RPN calculator in awk. In parallel, I got
the idea that my preferred text editor ed should be easy to
implement in awk. And the combination of the two is obvious,
especially as it would also allow me to get my own expandable
ed implementation.
Now I could of course write the thing by using ed, but it would
be much nicer to somehow bootstrap the project without.
Therefore I've started with a very basic editor programmed in
shellscript: it can only work on entire lines, and only advance
in a file, so I'm calling it the Forward EDitor fed.
(Internally, it reads the lines of the file in a loop, accepts
a command per line and acts on that, writes the result in a
temporary file, and at the end copies that back to the original.)
To keep the overall spirit, initially I wrote fed only using cat
and awk, and then with itself as soon as it was in "beta".
And this post was also written with fed.
When aced will be in beta, I will then use it again to improve
itself, and abandon fed.
And the whole process will be public, as others can follow the
evolution in the git repo of aced.