forth-stuff/ForthDictionary.tl

22 lines
432 B
Plaintext

local state = require("ForthState")
local wordinfo = require("ForthWordInfo")
local ForthDictionary = {}
global type Dictionary = record
contents: {string: WordInfo}
end
function Dictionary:define(word: string, info: WordInfo)
self.contents[word] = info
end
local dict_mt = {__index = Dictionary}
function Dictionary:new(): Dictionary
return setmetatable({contents = {}} as Dictionary, dict_mt)
end
return ForthDictionary