Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

A JavaScript-complete Postfix Engine web page demo

44 views
Skip to first unread message

lsng....@gmail.com

unread,
May 19, 2018, 3:25:11 AM5/19/18
to
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.

It demonstrates how a high level programming language (3rd generation programming language) like JavaScript (the host language), can be used to implement a postfix engine, which in turn be used to mapped to functions in the host language, using low level construct like eval(). It enables programmers to write program with a limited real estate (html textarea) using postfix notation (reverse polish notation), whose simple syntax has great educational values to the ever increasing population served by mobile (computing) devices, but have been hampered by hurdles created by "modern" programming tools and "frameworks" (such as MVC).

The same principles can be generalized to other 3rd generation programming languages.

The name 5GL, Fifth Generation Graph Language, is used in honour of Forth (the Forth (generation) programming language), to signify the ability of postfix notation to translate the 3rd generation programming languages.

-- Full article hosted on Google Drive, with screenshots:

https://docs.google.com/document/d/e/2PACX-1vQMiHObRlLQEtyMWpkeh-t41qu13Dq_ol1YzXviENtc4MUB_cKU1UHFStLJNyJqziiuoH5i_dRJe9Su/pub

lsng....@gmail.com

unread,
May 19, 2018, 5:43:01 AM5/19/18
to
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).

0 new messages