User loginNavigation |
Introducing AmbiI love RPN calculators and have been experimenting with how it may be possible to extend the RPN stack style into a structured programming language. Ambi is the result. Here is Ambi for the factorial function and an invocation:
5 ! .; (The 'import' operator pops the top stack item from the calling context and pushed it onto the expression's stack. 'export' is the converse pushing the top of the expression's stack back out into the calling context's stack.) Notice that the program is written using Polish (prefix) notation without any brackets and individual expressions are written in Reverse Polish (postfix) notation. Actually, Ambi doesn't care whether the programmer writes the program (and individual expressions) in prefix or postfix notation. Here is the exact same program written in postfix.
Ambi is an open source language and has been implemented in browser-based Javascript and an interpreter and documentation lives at http://www.davidpratten.com/ambi There are lots of example programs there that can be loaded into the interpreter just by clicking on them. Ambi owes a debt to Forth, RPL and to CAT. CAT (and earlier) JOY elected to make the composition operator implicit, whereas in Ambi it is made explicit in the 'seq' operator. Your observations, suggestions, and/or critique are welcome. David By David Pratten at 2009-01-26 18:16 | LtU Forum | previous forum topic | next forum topic | other blogs | 6195 reads
|
Browse archives
Active forum topics |
Recent comments
22 weeks 6 days ago
22 weeks 6 days ago
22 weeks 6 days ago
45 weeks 19 hours ago
49 weeks 2 days ago
50 weeks 6 days ago
50 weeks 6 days ago
1 year 1 week ago
1 year 6 weeks ago
1 year 6 weeks ago