pile.js

From Esolang
Jump to navigation Jump to search
This is still a work in progress. It may be changed in the future.

pile.js is a combination of an esoteric library for JavaScript (aka ECMAScript) and a coding style that requires you to use a rather strange data model for all operations- the stack. However, everything is still Javascript, so you can't use postfix as one normally would, making everything 1,000,000% more confusing for JavaScript programmers and concatenative programmers alike.

The Library

pile.js contains, as its main function, a single object: the bistack. The bistack consists of two stacks of any data that normal JS supports, and is usually used to emulate a tape. The stacks are called "main" and "offhand", and most commands only manipulate the main stack.

The bistack has the following commands:

Command Laconic Description
push N/A Yields a function which PUSHes the one argument of the first function onto the main stack
drop $ POP a value and discard it
dup : POP a value and PUSH it twice
swap \ POP two values and push them in the same order, effectively swapping their locations