Demo on how to produce the Fibonacci Sequence in Javascript - Concatenative-style.
Drawing inspiration from Concatenative Programming Languages, such as Forth and Factor,
this demonstration relies on recursion or iteration only for ease-of-use rather than functionality.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BNF = { } | |
-- create definition | |
BNF["::="] = function (stack) | |
local non_terminal = pop(stack) ; | |
push(BNF,non_terminal) ; end | |
-- add words to definition | |
BNF[";"] = function (stack) | |
local non_terminal = pop(BNF) |