I've happened upon one of my old projects, and was wondering if you guys could help me figure out what it should be doing, what it's doing now, and why it's doing it, here's the info I've gathered.

This is the Heiarchy;

main input -- stringValue, value is 5+1/7-3 ZeroScript -- Folder cradle -- the main Script, enabled, 181 lines cradle.BKP -- Emptier version of above, disabled, 78 lines OS -- ModuleScript

OS has the following functions; Write(s) -- Prints a string WriteLn(s) -- Exactly the same as above Halt() -- Prints "Halt" In(x,t) -- checks if item x is in table t OS has the following tables; Alphas -- All capital letters Digits -- 1-0 D -- {nil,nil,nil,nil,nil,nil,nil,nil} S -- empty table the module returns Write, WriteLn, Halt, In, Alphas, Digits, 'ready', D, S in that order This is the Output; start 1 ready 2 ZerOS DEBUG MODE DEBUG; 5 DEBUG; 5

This is the 'cradle' script

print("start")

DEBUG = true -- set to false to disable debug printing

input = script.Parent.Parent.input -- fake input

print("1")
-- Necessary Functions
OS = require(script.Parent.OS)
print(OS[7])
D = OS[8]
SP = OS[9]
print('2')

Write = OS[1]
WriteLn = OS[2]
Halt = OS[3]
In = OS[4]

rd = 0
function Read()
	rd = rd + 1
	local re = string.sub(input.Value,rd,rd)
	PrintD(re)
	return re
end

function SP_push(x)
	PrintD(x)
	table.insert(SP, x)
end

function SP_pop()
	local rt = SP[-1]
	PrintD(rt)
	table.remove(SP)
	return rt
end
-- Debug Function
function PrintD(s)
	if DEBUG == true then
	if s ~= nil then
		WriteLn("DEBUG; "..s)
	else
		WriteLn("DEBUG MODE")
	end
	end
end	
-- Necessary Tables
Alphas = OS[5]
Digits = OS[6]
-- Compiler
local TAB = "	" -- Tab
local Look = "" -- lookup a char
	
local function GetChar() -- get Look
	Look = Read()
end

local function Error(s) -- Write an error
	warn("Error: "..s..".")
end	

local function Abort(s) -- Abort the program
	Error(s)
	Halt()
end

local function Expected(s) -- Write a "Char Expected" Error
	Abort(s.. " Expected")
end

local function Match(x) -- Match Characters
	if Look == x then GetChar() else
		Expected('"'..x..'"')
	end
end
	
local function IsAlpha(c) -- Check if a character is an Alpha Letter
	return In(string.upper(c),Alphas)
end


local function IsDigit(c) -- Check if a character is a Digit
	return In(c,Digits)
end

local function GetName() -- Get a Name
	if not IsAlpha(Look) then Expected('Name') end
	PrintD(string.upper(Look))
	return string.upper(Look)
end

local function GetNum() -- Get a Number
	if not IsDigit(Look) then Expected('Integer') end
	PrintD(Look)
	return Look
end

local function Emit(s) -- Print a String
	Write(TAB..s)
end

local function EmitLn(s) -- Print a String on a new line
	Emit(s)
	WriteLn()
end

--local function Term() -- Term
--	--Look = '7'
--	D[1] = GetNum()
--end

local function Factor()
	D[1] = GetNum()
end

local function Multiply()
	Match('*')
	Factor()
	EmitLn(SP_pop() * D[1])
end

local function Divide()
	Match('/')
	Factor()
	D[2] = SP_pop
	EmitLn(D[2]/D[1])
end

local function Term()
	Factor()
	while Look == '*' or Look == '?' do
		SP_push(D[1]) D[1] = nil
		
		if Look == '*' then
			Multiply()
		elseif Look == '/' then
			Divide()
		else Expected("Mulop") end
	end
end

local function Add() -- add
	Match('+')
	Term()
	EmitLn(SP_pop() + D[1])
end

local function Subtract() -- subtract
	Match('-')
	Term()
	EmitLn(SP_pop()-D[1])
end

local function Expression() -- Expressions
	Term()
	while Look == '+' or Look == '-' do
		SP_push(D[1]) D[1] = nil
		
		if Look == '+' then
			Add()
		elseif Look == '-' then
			Subtract()
		else Expected("Addop") end
			
	end
end

local function Init() -- Initiate
	GetChar()
end

local function begin() -- Start Function
	WriteLn("ZerOS")
	PrintD()
	Init()
	Expression()
end

begin() -- Run

this is the cradle.BKP script

-- Necessary Functions

OS = require(script.Parent.OS)

Write = OS[1]
WriteLn = OS[2]
Halt = OS[3]
In = OS[4]
-- Necessary Tables
Alphas = OS[5]
Digits = OS[6]


-- Compiler
local TAB = "	" -- Tab
local Look = "r" -- lookup a char
	
local function GetChar() -- get Look
	return Look
end

local function Error(s) -- Write an error
	WriteLn("Error: "..s..".") 
end	

local function Abort(s) -- Abort the program
	Error(s)
	Halt()
end

local function Expected(s) -- Write a "Char Expected" Error
	Abort(s.. " Expected")
end

local function Match(x) -- Match Characters
	if Look == x then GetChar() else
		Expected('"'..x..'"')
	end
end
	
local function IsAlpha(c) -- Check if a character is an Alpha Letter
	return In(string.upper(c),Alphas)
end


local function IsDigit(c) -- Check if a character is a Digit
	return In(c,Digits)
end

local function GetName() -- Get a Name
	if not IsAlpha(Look) then Expected('Name') end
	return string.upper(Look)
end

local function GetNum() -- Get a Number
	if not IsDigit(Look) then Expected('Integer') end
	return Look
end

local function Emit(s) -- Print a String
	Write(TAB..s)
end

local function EmitLn(s) -- Print a String on a new line
	Emit(s)
	WriteLn()
end

local function Init()
	GetChar()
end

local function begin()
	Init()
	WriteLn("ZerOS")
end

begin()

I think it's supposed to read the input, and output something, but I'm not entirely sure what I was trying to do.