-- For your main program which will call functions from the modules.

os.execute("clear")
print(" ↳  Welcome to DDB Framework Rev. -1")
Execute(MatchReplace(note,Nope),"Log beginning at " .. os.date() ,nil,true)

Execute(MatchReplace(printnote,Nope),"Loading function name map.")
Execute(ApplyTemplateToTable,_G,MatchReplace(FunctionNameMap,{}))

-- Incomplete, requires lua-like string-to-our-table conversion.
-- All others will be string-to-our-type conversions.
-- The ability to hold brand new variable pointers in a local cache of some kind should be considered.
-- This is necessary for distinguishing between variables and strings.
local RecursiveDefineLocalTable = {
	{{},{4,2}},
	{TableUnpack,{4,1}},
	{ReturnEmptyTable,3},
	{RecursiveTableAdd,2},
	{ProcessAndExecuteList,1},
}


local CounterTest = {}

local CounterHalt = {
{"Condition reached. Halting",2},
{printnote,1},
}

local CounterRecurse = {
	{1,{4,2}},
	{10,5},
	{Increment,{4,1}},
	{"Condition not reached. Recursing",{5,2}},
	{printnote,{5,1}},
	{CounterTest,3},
	{ExecuteFromTemplate,2},
	{ProcessAndExecuteList,1},
}

local function IsEqualOrGreaterThanToBool(innum,innum2)
	return innum >= innum2
end

local CounterTest = RecursiveTableAdd(CounterTest,
	{1,{3,5,2,3},{3,3,2},{3,6,3}},
	{10,{3,5,2,4},{3,3,3},{3,6,5}},
	{CounterRecurse,{3,5,2,2}},
	{CounterHalt,{3,4,2,2}},
	{ExecuteFromTemplate,{3,4,2,1},{3,5,2,1}},
	{"out of",{3,6,4}},
	{"Loop",{3,6,2}},
	{printnote,{3,6,1}},
	{Return,{3,4,1},{3,5,1}},
	{IsEqualOrGreaterThanToBool,{3,3,1}},
	{Select,{3,2}},
	{Return,2},
	{ProcessAndExecuteList,1,{3,1}}
)
