From 01d92a6b8c0d9665862357e44110fcc133c706ed Mon Sep 17 00:00:00 2001 From: Starfflame Date: Mon, 10 May 2021 01:32:30 -0500 Subject: [PATCH] remove compiled lua files --- ForthStack.lua | 51 -------------------------------------------------- ForthState.lua | 3 --- 2 files changed, 54 deletions(-) delete mode 100644 ForthStack.lua delete mode 100644 ForthState.lua diff --git a/ForthStack.lua b/ForthStack.lua deleted file mode 100644 index e87b791..0000000 --- a/ForthStack.lua +++ /dev/null @@ -1,51 +0,0 @@ -local _tl_compat; if (tonumber((_VERSION or ''):match('[%d.]*$')) or 0) < 5.3 then local p, m = pcall(require, 'compat53.module'); if p then _tl_compat = m end end; local table = _tl_compat and _tl_compat.table or table; local ForthStack = {} - - - - Stack = {} - - - - - - -function Stack:push(val) - self.top = self.top + 1 - table.insert(self.contents, val) -end -function Stack:pop() - self.top = self.top - 1 - if self.top < 0 then - error("Stack underflow") - end - return table.remove(self.contents) -end -local stack_mt = { __index = Stack } -function Stack:new() - return setmetatable({ contents = {}, top = 0 }, stack_mt) -end - - - -function ForthStack.add(stack) - local a = stack:pop() - local b = stack:pop() - if type(a) == "number" and type(b) == "number" then - local c = a + b - stack:push(c) - else - error("invalid operands for add operation!") - end -end -function ForthStack.dot(s) - print(s:pop()) -end -local s = Stack:new() -s:push(1) -s:push(4) -ForthStack.add(s) -print(ForthStack.dot(s)) - - - -return ForthStack diff --git a/ForthState.lua b/ForthState.lua deleted file mode 100644 index 634bc2e..0000000 --- a/ForthState.lua +++ /dev/null @@ -1,3 +0,0 @@ -local ForthStack = require("ForthStack") - -local GlobalState = {}