March 6 2023
Creating an efficient way to search for events in the log had eluded me for a long time. I wanted to be able to search for complex events, things like "the rising edge of channel 3 while both channels 1 and 2 are high."
I finally have the solution: A simple scripting language that tests each state. The script allows the user to test for any condition, from very simple to incredibly complex. The trick was to make the script execution very fast, since it would need to run on a large number of states, possibly in the hundreds of thousands or even millions.
This is accomplished by rendering the user's script down to optimized byte-code that can be parsed very quickly.
The script is written using a modified form of RPN (Reverse Polish Notation), something that will be familiar to anyone who has used HP calculators. RPN pushes arguments onto a stack and then functions pop the arguments and push the result. RPN looks strange at first, but it really is the most efficient way to break down complex sequences. And from the computer's perspective it is incredibly fast and efficient.
The script will find the longest time spent inside a function.