new file: HASHBASE/console-utils/log.py
new file: HASHBASE/operators/add.py new file: HASHBASE/operators/divide.py new file: HASHBASE/operators/equal.py new file: HASHBASE/operators/higher.py new file: HASHBASE/operators/lower.py new file: HASHBASE/operators/multiply.py new file: HASHBASE/operators/remainder.py new file: HASHBASE/operators/subtract.py new file: HASHBASE/statements/create.py new file: HASHBASE/statements/getatt.py new file: HASHBASE/statements/if.py new file: HASHBASE/statements/newobj.py new file: HASHBASE/statements/setatt.py modified: PCPL/interpreter.py modified: hashengine.py deleted: langsys/__pycache__/__init__.cpython-311.pyc modified: langsys/lang/de_DE.LAN modified: langsys/lang/en_EN.LAN modified: main.pymain
parent
8cbf5effee
commit
4bb3864d20
|
@ -0,0 +1,27 @@
|
|||
class main():
|
||||
def IND(self, index):
|
||||
print("Indexing is not supported with this instruction")
|
||||
return (1)
|
||||
def EXEC(self, params):
|
||||
end = "\n"
|
||||
flush = False
|
||||
text = ""
|
||||
if len(params) > 0:
|
||||
text = params[0]
|
||||
if len(params) > 1:
|
||||
end = params[1]
|
||||
if len(params) > 2:
|
||||
flush = bool(params[2])
|
||||
if len(params) > 3:
|
||||
return (1)
|
||||
print(text, end=end, flush=flush)
|
||||
return (0, None)
|
||||
def ATR(self, target):
|
||||
print("Getting an attribute is not supported with this instruction")
|
||||
return (1)
|
||||
def STAT(self, params):
|
||||
print("Statements are not supported with this instruction")
|
||||
return (1)
|
||||
def OP(self, arg1, arg2):
|
||||
print("Operations are not supported with this instruction")
|
||||
return (1)
|
|
@ -0,0 +1,18 @@
|
|||
class main():
|
||||
def IND(self, index):
|
||||
print("Indexing is not supported with this instruction")
|
||||
return (1)
|
||||
def EXEC(self, params):
|
||||
print("Execution is not supported with this instruction")
|
||||
return (1)
|
||||
def ATR(self, target):
|
||||
print("Getting an attribute is not supported with this instruction")
|
||||
return (1)
|
||||
def STAT(self, params):
|
||||
print("Statements are not supported with this instruction")
|
||||
return (1)
|
||||
def OP(self, arg1, arg2):
|
||||
if arg1.isnumeric() and arg2.isnumeric():
|
||||
return (0, int(arg1)+int(arg2))
|
||||
else:
|
||||
return (0, arg1+arg2)
|
|
@ -0,0 +1,18 @@
|
|||
class main():
|
||||
def IND(self, index):
|
||||
print("Indexing is not supported with this instruction")
|
||||
return (1)
|
||||
def EXEC(self, params):
|
||||
print("Execution is not supported with this instruction")
|
||||
return (1)
|
||||
def ATR(self, target):
|
||||
print("Getting an attribute is not supported with this instruction")
|
||||
return (1)
|
||||
def STAT(self, params):
|
||||
print("Statements are not supported with this instruction")
|
||||
return (1)
|
||||
def OP(self, arg1, arg2):
|
||||
if arg1.isnumeric() and arg2.isnumeric():
|
||||
return (0, int(arg1)/int(arg2))
|
||||
else:
|
||||
return (1)
|
|
@ -0,0 +1,18 @@
|
|||
class main():
|
||||
def IND(self, index):
|
||||
print("Indexing is not supported with this instruction")
|
||||
return (1)
|
||||
def EXEC(self, params):
|
||||
print("Execution is not supported with this instruction")
|
||||
return (1)
|
||||
def ATR(self, target):
|
||||
print("Getting an attribute is not supported with this instruction")
|
||||
return (1)
|
||||
def STAT(self, params):
|
||||
print("Statements are not supported with this instruction")
|
||||
return (1)
|
||||
def OP(self, arg1, arg2):
|
||||
if str(arg1) == str(arg2):
|
||||
return (0, True)
|
||||
else:
|
||||
return (0, False)
|
|
@ -0,0 +1,21 @@
|
|||
class main():
|
||||
def IND(self, index):
|
||||
print("Indexing is not supported with this instruction")
|
||||
return (1)
|
||||
def EXEC(self, params):
|
||||
print("Execution is not supported with this instruction")
|
||||
return (1)
|
||||
def ATR(self, target):
|
||||
print("Getting an attribute is not supported with this instruction")
|
||||
return (1)
|
||||
def STAT(self, params):
|
||||
print("Statements are not supported with this instruction")
|
||||
return (1)
|
||||
def OP(self, arg1, arg2):
|
||||
if arg1.isnumeric() and arg2.isnumeric():
|
||||
if arg1 > arg2:
|
||||
return (0, True)
|
||||
else:
|
||||
return (0, False)
|
||||
else:
|
||||
return (1)
|
|
@ -0,0 +1,21 @@
|
|||
class main():
|
||||
def IND(self, index):
|
||||
print("Indexing is not supported with this instruction")
|
||||
return (1)
|
||||
def EXEC(self, params):
|
||||
print("Execution is not supported with this instruction")
|
||||
return (1)
|
||||
def ATR(self, target):
|
||||
print("Getting an attribute is not supported with this instruction")
|
||||
return (1)
|
||||
def STAT(self, params):
|
||||
print("Statements are not supported with this instruction")
|
||||
return (1)
|
||||
def OP(self, arg1, arg2):
|
||||
if arg1.isnumeric() and arg2.isnumeric():
|
||||
if arg1 < arg2:
|
||||
return (0, True)
|
||||
else:
|
||||
return (0, False)
|
||||
else:
|
||||
return (1)
|
|
@ -0,0 +1,18 @@
|
|||
class main():
|
||||
def IND(self, index):
|
||||
print("Indexing is not supported with this instruction")
|
||||
return (1)
|
||||
def EXEC(self, params):
|
||||
print("Execution is not supported with this instruction")
|
||||
return (1)
|
||||
def ATR(self, target):
|
||||
print("Getting an attribute is not supported with this instruction")
|
||||
return (1)
|
||||
def STAT(self, params):
|
||||
print("Statements are not supported with this instruction")
|
||||
return (1)
|
||||
def OP(self, arg1, arg2):
|
||||
if arg1.isnumeric() and arg2.isnumeric():
|
||||
return (0, int(arg1)*int(arg2))
|
||||
else:
|
||||
return (0, arg1*arg2)
|
|
@ -0,0 +1,18 @@
|
|||
class main():
|
||||
def IND(self, index):
|
||||
print("Indexing is not supported with this instruction")
|
||||
return (1)
|
||||
def EXEC(self, params):
|
||||
print("Execution is not supported with this instruction")
|
||||
return (1)
|
||||
def ATR(self, target):
|
||||
print("Getting an attribute is not supported with this instruction")
|
||||
return (1)
|
||||
def STAT(self, params):
|
||||
print("Statements are not supported with this instruction")
|
||||
return (1)
|
||||
def OP(self, arg1, arg2):
|
||||
if arg1.isnumeric() and arg2.isnumeric():
|
||||
return (0, int(arg1)%int(arg2))
|
||||
else:
|
||||
return (1)
|
|
@ -0,0 +1,16 @@
|
|||
class main():
|
||||
def IND(self, index):
|
||||
print("Indexing is not supported with this instruction")
|
||||
return (1)
|
||||
def EXEC(self, params):
|
||||
print("Execution is not supported with this instruction")
|
||||
return (1)
|
||||
def ATR(self, target):
|
||||
print("Getting an attribute is not supported with this instruction")
|
||||
return (1)
|
||||
def STAT(self, params):
|
||||
print("Statements are not supported with this instruction")
|
||||
return (1)
|
||||
def OP(self, arg1, arg2):
|
||||
if arg1.isnumeric() and arg2.isnumeric():
|
||||
return (0, int(arg1)-int(arg2))
|
|
@ -0,0 +1,41 @@
|
|||
class main():
|
||||
def __init__(self, interpreter):
|
||||
self.interpreter = interpreter
|
||||
|
||||
def IND(self, index):
|
||||
print("Indexing is not supported with this instruction")
|
||||
return (1)
|
||||
def EXEC(self, params):
|
||||
print("Execution is not supported with this instruction")
|
||||
return (1)
|
||||
def ATR(self, target):
|
||||
print("Getting an attribute is not supported with this instruction")
|
||||
return (1)
|
||||
def STAT(self, params):
|
||||
class temp():
|
||||
def __init__(self, interpreter):
|
||||
self.interpreter = interpreter
|
||||
self.CS = ""
|
||||
self.STRtypes = ['"', "<", "{", "[", "(", ":"]
|
||||
self.ENDtypes = ['"', ">", "}", "]", ")", ";"]
|
||||
def IND(self, index):
|
||||
return (0, self.CS[index])
|
||||
def EXEC(self, params):
|
||||
PREPEDAST = self.interpreter.lexer.tokenGEN(self.CS, self.STRtypes, self.ENDtypes)
|
||||
PREPEDAST = self.interpreter.PREPAST(PREPEDAST)
|
||||
PREPEDAST = self.interpreter.EXECINS(PREPEDAST)
|
||||
return (0, PREPEDAST)
|
||||
def ATR(self, target):
|
||||
return (0, self.CS)
|
||||
def STAT(self, params):
|
||||
self.CS = params[0]
|
||||
return (0, None)
|
||||
def OP(self, arg1, arg2):
|
||||
print("Operations are not supported with this CI")
|
||||
return (1)
|
||||
tempC = temp(self.interpreter)
|
||||
self.interpreter.vars[params[0]] = tempC
|
||||
return (0, None)
|
||||
def OP(self, arg1, arg2):
|
||||
print("Operations are not supported with this instruction")
|
||||
return (1)
|
|
@ -0,0 +1,18 @@
|
|||
class main():
|
||||
def __init__(self, interpreter):
|
||||
self.interpreter = interpreter
|
||||
|
||||
def IND(self, index):
|
||||
print("Indexing is not supported with this instruction")
|
||||
return (1)
|
||||
def EXEC(self, params):
|
||||
print("Execution is not supported with this instruction")
|
||||
return (1)
|
||||
def ATR(self, target):
|
||||
return (0, getattr(self.interpreter.vars[target[0]], target[1]))
|
||||
def STAT(self, params):
|
||||
print("Statements are not supported with this instruction")
|
||||
return (1)
|
||||
def OP(self, arg1, arg2):
|
||||
print("Operations are not supported with this instruction")
|
||||
return (1)
|
|
@ -0,0 +1,23 @@
|
|||
class main():
|
||||
def __init__(self, interpreter):
|
||||
self.interpreter = interpreter
|
||||
|
||||
def IND(self, index):
|
||||
print("Indexing is not supported with this instruction")
|
||||
return (1)
|
||||
def EXEC(self, params):
|
||||
print("Execution is not supported with this instruction")
|
||||
return (1)
|
||||
def ATR(self, target):
|
||||
print("Getting an attribute is not supported with this instruction")
|
||||
return (1)
|
||||
def STAT(self, params):
|
||||
if str(params[1]) == "True":
|
||||
if params[0] in self.interpreter.instructions:
|
||||
self.interpreter.instructions[params[0]].EXEC([])
|
||||
elif params[0] in self.interpreter.vars:
|
||||
self.interpreter.vars[params[0]].EXEC([])
|
||||
return (0, None)
|
||||
def OP(self, arg1, arg2):
|
||||
print("Operations are not supported with this instruction")
|
||||
return (1)
|
|
@ -0,0 +1,20 @@
|
|||
class main():
|
||||
def __init__(self, interpreter):
|
||||
self.interpreter = interpreter
|
||||
|
||||
def IND(self, index):
|
||||
print("Indexing is not supported with this instruction")
|
||||
return (1)
|
||||
def EXEC(self, params):
|
||||
print("Execution is not supported with this instruction")
|
||||
return (1)
|
||||
def ATR(self, target):
|
||||
print("Getting an attribute is not supported with this instruction")
|
||||
return (1)
|
||||
def STAT(self, params):
|
||||
object = self.interpreter.ENG.object()
|
||||
self.interpreter.vars[params[0]] = object
|
||||
return (0, None)
|
||||
def OP(self, arg1, arg2):
|
||||
print("Operations are not supported with this instruction")
|
||||
return (1)
|
|
@ -0,0 +1,19 @@
|
|||
class main():
|
||||
def __init__(self, interpreter):
|
||||
self.interpreter = interpreter
|
||||
|
||||
def IND(self, index):
|
||||
print("Indexing is not supported with this instruction")
|
||||
return (1)
|
||||
def EXEC(self, params):
|
||||
print("Execution is not supported with this instruction")
|
||||
return (1)
|
||||
def ATR(self, target):
|
||||
setattr(self.interpreter.vars[target[0]], target[1], target[2])
|
||||
return (0, None)
|
||||
def STAT(self, params):
|
||||
print("Statements are not supported with this instruction")
|
||||
return (1)
|
||||
def OP(self, arg1, arg2):
|
||||
print("Operations are not supported with this instruction")
|
||||
return (1)
|
|
@ -14,9 +14,7 @@ class interpreter():
|
|||
def INDEXING(self, target):
|
||||
target = target[1:]
|
||||
target = target[:-1]
|
||||
target = target.split(",")
|
||||
for i in range(len(target)):
|
||||
target[i] = target[i].replace(".", ",")
|
||||
target = target.split("\,")
|
||||
if target[0] in self.instructions:
|
||||
return self.instructions[target[0]].IND(target[1])
|
||||
elif target[0] in self.vars:
|
||||
|
|
|
@ -120,7 +120,6 @@ class obj:
|
|||
self.position = vector2()
|
||||
self.char = " "
|
||||
self.ID = 0
|
||||
self.parent = None
|
||||
self.gravity = 0
|
||||
self.acceleration = vector2()
|
||||
self.velocity = vector2()
|
||||
|
|
Binary file not shown.
|
@ -4,4 +4,7 @@
|
|||
"open": "Oeffnen",
|
||||
"exit": "Beenden",
|
||||
"langs": "Sprachen",
|
||||
"add": "Erstellen",
|
||||
"obj": "Objekt",
|
||||
"script": "Skript",
|
||||
}
|
|
@ -4,4 +4,7 @@
|
|||
"open": "Open",
|
||||
"exit": "Quit",
|
||||
"langs": "Languages",
|
||||
"add": "Create",
|
||||
"obj": "Object",
|
||||
"script": "Script",
|
||||
}
|
28
main.py
28
main.py
|
@ -1,3 +1,6 @@
|
|||
import sys
|
||||
|
||||
sys.dont_write_bytecode = True
|
||||
import mtTkinter as tk
|
||||
from tkinter import ttk as tkk
|
||||
import PCPL
|
||||
|
@ -8,12 +11,25 @@ import sys
|
|||
import hashengine
|
||||
|
||||
global LH
|
||||
global gamedata
|
||||
gamedata = []
|
||||
LH = langsys.langhandler()
|
||||
lang = open("clang", 'r')
|
||||
lang = lang.read()
|
||||
LH.setlang(lang)
|
||||
# LH.string("")
|
||||
|
||||
PCPL.interpreter.ENG = hashengine
|
||||
|
||||
class script:
|
||||
def __init__(self):
|
||||
self.code = ""
|
||||
|
||||
def execute(self):
|
||||
PCPL.resetvar()
|
||||
PCPL.LIS("HASHBASE")
|
||||
PCPL.run(self.code)
|
||||
|
||||
class preview:
|
||||
def __init__(self, size, container, offset):
|
||||
self._size = size
|
||||
|
@ -48,6 +64,11 @@ def selectlang(new):
|
|||
container.quit()
|
||||
subprocess.Popen([sys.executable, __file__])
|
||||
|
||||
def add(objtype):
|
||||
obj = dir(types)[objtype]()
|
||||
temp = {"id": objtype, "args": dir(obj)}
|
||||
gamedata.append(temp())
|
||||
|
||||
def GUIinit():
|
||||
global container
|
||||
container = tk.Tk()
|
||||
|
@ -66,6 +87,10 @@ def GUIinit():
|
|||
filemenu.add_separator()
|
||||
filemenu.add_command(label=LH.string("exit"), command=container.quit)
|
||||
|
||||
addmenu = tk.Menu(menu)
|
||||
menu.add_cascade(label=LH.string("add"), menu=addmenu)
|
||||
filemenu.add_command(label=LH.string("obj"), command=lambda: add("obj"))
|
||||
|
||||
langmenu = tk.Menu(menu)
|
||||
menu.add_cascade(label=LH.string("langs"), menu=langmenu)
|
||||
for i in LH.getlangs():
|
||||
|
@ -73,4 +98,7 @@ def GUIinit():
|
|||
|
||||
container.mainloop()
|
||||
|
||||
global types
|
||||
types = hashengine.enum({"obj": hashengine.obj, "script": script})
|
||||
|
||||
GUIinit()
|
Loading…
Reference in New Issue