mirror of
https://github.com/notwa/lips
synced 2024-11-14 09:49:02 -08:00
set up as a proper module; fix some stuff
This commit is contained in:
parent
9612de6869
commit
9fd46b571f
7 changed files with 26 additions and 11 deletions
|
@ -1,13 +1,13 @@
|
|||
local insert = table.insert
|
||||
local floor = math.floor
|
||||
|
||||
local data = require "data"
|
||||
local data = require "lips.data"
|
||||
|
||||
local function bitrange(x, lower, upper)
|
||||
return floor(x/2^lower) % 2^(upper - lower + 1)
|
||||
end
|
||||
|
||||
local Dumper = require("Class")()
|
||||
local Dumper = require("lips.Class")()
|
||||
function Dumper:init(writer, fn, options)
|
||||
self.writer = writer
|
||||
self.fn = fn or '(string)'
|
|
@ -1,10 +1,21 @@
|
|||
local byte = string.byte
|
||||
local char = string.char
|
||||
local find = string.find
|
||||
local open = io.open
|
||||
|
||||
local data = require "data"
|
||||
local data = require "lips.data"
|
||||
|
||||
local Lexer = require("Class")()
|
||||
local function readfile(fn)
|
||||
local f = open(fn, 'r')
|
||||
if not f then
|
||||
error('could not open assembly file for reading: '..tostring(fn), 2)
|
||||
end
|
||||
local asm = f:read('*a')
|
||||
f:close()
|
||||
return asm
|
||||
end
|
||||
|
||||
local Lexer = require("lips.Class")()
|
||||
function Lexer:init(asm, fn, options)
|
||||
self.asm = asm
|
||||
self.fn = fn or '(string)'
|
|
@ -1,12 +1,12 @@
|
|||
local insert = table.insert
|
||||
local format = string.format
|
||||
|
||||
local data = require "data"
|
||||
local overrides = require "overrides"
|
||||
local Dumper = require "Dumper"
|
||||
local Lexer = require "Lexer"
|
||||
local data = require "lips.data"
|
||||
local overrides = require "lips.overrides"
|
||||
local Dumper = require "lips.Dumper"
|
||||
local Lexer = require "lips.Lexer"
|
||||
|
||||
local Parser = require("Class")()
|
||||
local Parser = require("lips.Class")()
|
||||
function Parser:init(writer, fn, options)
|
||||
self.fn = fn or '(string)'
|
||||
self.main_fn = self.fn
|
|
@ -12,7 +12,9 @@ local assembler = {
|
|||
]],
|
||||
}
|
||||
|
||||
local Parser = require "Parser"
|
||||
local open = io.open
|
||||
|
||||
local Parser = require "lips.Parser"
|
||||
|
||||
local function readfile(fn)
|
||||
local f = open(fn, 'r')
|
|
@ -1,4 +1,6 @@
|
|||
local data = require "data"
|
||||
local insert = table.insert
|
||||
|
||||
local data = require "lips.data"
|
||||
local instructions = data.instructions
|
||||
|
||||
local overrides = {}
|
Loading…
Reference in a new issue