On Saturday, May 19, 2018 at 3:25:11 PM UTC+8,
lsng....@gmail.com wrote:
> A JavaScript-complete Postfix Engine web page demo
>
> A simple JavaScript-complete Postfix Engine which takes JavaScript function names written in postfix (reverse polish notation), without variable names and punctuation (except the colon suffix (‘:’) to designate a command), has been implemented.
2) Using a Firefox browser, enter the following commands in the Developer's Console:
var node = document.createElement("LI"); // Create a <li> node
var textnode = document.createTextNode("Water"); // Create a text node
node.appendChild(textnode); // Append the text to <li>
document.getElementById("rpout").appendChild(node); // Append <li> to <ul> with id="myList"
As shown in figure 2, the text “Water” will appear below the “Execute” button, an area designated by the ID “rpout”.
3) Refresh the web page:
http://5gl.pagekite.me/h/fe/glv.html
Enter the following commands in the text box (textarea), and press “Execute” (figure 3):
'Water' createTextNode document .: f: e:
'LI' createElement document .: f: e:
appendChild swap: s: pfc:
'rpout' getElementById document .: f: e:
appendChild swap: s: pfc:
The commands above do exactly the same thing as (2), after a series of browser alert() messages (figure 4), except using Postfix (Reverse Polish Notation), using a programming language called 5GL (Fifth Generation Graph Language).