Skip to content

Instantly share code, notes, and snippets.

@VentGrey
Created March 3, 2019 02:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save VentGrey/dc5f646f5826a368677997e5e196af9d to your computer and use it in GitHub Desktop.
Save VentGrey/dc5f646f5826a368677997e5e196af9d to your computer and use it in GitHub Desktop.
evaluator workflow

If you want to evalue a simple but nontheless important expression like: `5 1 2 + 4 * + 3 −´

read 5
read 1
read 2
read +. + is an operator which takes 2 args, so calculate 1+2 and replace with the result (3). The expression is now 5 3 4 * + 3 -
read 4
read *. * is an operator which takes two args, so calculate 3*4 and replace with the result, 12. The expression is reduced to 5 12 + 3 -
read +. + is an operator which takes two args, so calculate 5+12, replace by the result, 17. Now, we have 17 3 -
read 3
read -. - is an operator which takes two args, so calculate 17-3. The result is 14.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment