part 1
This commit is contained in:
@@ -2,8 +2,34 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
def readfile(filepath):
|
def readfile(filepath, printFile):
|
||||||
with open(filepath, "r") as file:
|
with open(filepath, "r") as file:
|
||||||
|
fileExportBuffer = []
|
||||||
|
|
||||||
lines = file.readlines()
|
lines = file.readlines()
|
||||||
|
print(lines)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
lineNum = 0
|
||||||
for line in lines:
|
for line in lines:
|
||||||
print(line.strip())
|
|
||||||
|
line = line.strip()
|
||||||
|
fileExportBuffer.append(str(line))
|
||||||
|
lineNum += 1
|
||||||
|
|
||||||
|
print(fileExportBuffer)
|
||||||
|
return fileExportBuffer
|
||||||
|
|
||||||
|
|
||||||
|
def meshBuffer(fileExportBuffer, devlog):
|
||||||
|
meshedbuffer = ""
|
||||||
|
for text in fileExportBuffer:
|
||||||
|
meshedbuffer += text
|
||||||
|
if devlog: print("Meshed :" , meshedbuffer)
|
||||||
|
return meshedbuffer
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
81
Compiler/Fwritter.py
Normal file
81
Compiler/Fwritter.py
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
from enum import StrEnum
|
||||||
|
from re import split
|
||||||
|
|
||||||
|
|
||||||
|
fileBuffer = []
|
||||||
|
variables = []
|
||||||
|
|
||||||
|
class color(StrEnum):
|
||||||
|
RED = '\033[91m'
|
||||||
|
GREEN = '\033[92m'
|
||||||
|
YELLOW = '\033[93m'
|
||||||
|
BLUE = '\033[94m'
|
||||||
|
ENDC = '\033[0m'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
selectedApp = ""
|
||||||
|
|
||||||
|
def log(text,colorCode):
|
||||||
|
|
||||||
|
print(f"{colorCode} {text} {color.ENDC}")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def beginApp(name):
|
||||||
|
selectedApp = name
|
||||||
|
fileBuffer.append("προγραμμα "+ str(name))
|
||||||
|
fileBuffer.append("αρχη")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def CompileApp(buffer,devlogs):
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def grabScriptType(inBuffer: str,devlogs):
|
||||||
|
ScriptType = inBuffer.split(" ")
|
||||||
|
|
||||||
|
match ScriptType[0]:
|
||||||
|
case "App" | "Program":
|
||||||
|
print("Application Script")
|
||||||
|
|
||||||
|
if devlogs: print("App Name:" ,str(ScriptType[1]))
|
||||||
|
|
||||||
|
CompileApp(inBuffer, True)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
case "Lib" |"Library":
|
||||||
|
print("Library Script")
|
||||||
|
case "Ast" | "Asset":
|
||||||
|
print("Asset Script")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
case _:
|
||||||
|
log("Incorect Syntax @..." + str(ScriptType[0])+ " " +str(ScriptType[1])+"...", color.YELLOW)
|
||||||
|
log(" ╰──────> ERROR - ScriptType Not Declared", color.RED)
|
||||||
|
|
||||||
BIN
Compiler/__pycache__/Fparser.cpython-312.pyc
Normal file
BIN
Compiler/__pycache__/Fparser.cpython-312.pyc
Normal file
Binary file not shown.
BIN
Compiler/__pycache__/Fwritter.cpython-312.pyc
Normal file
BIN
Compiler/__pycache__/Fwritter.cpython-312.pyc
Normal file
Binary file not shown.
@@ -1,6 +1,7 @@
|
|||||||
import configparser
|
import configparser
|
||||||
import argparse
|
import argparse
|
||||||
import Fparser
|
import Fparser
|
||||||
|
import Fwritter
|
||||||
version = 1.0
|
version = 1.0
|
||||||
|
|
||||||
|
|
||||||
@@ -30,8 +31,9 @@ def checkDeps():
|
|||||||
|
|
||||||
|
|
||||||
def compileSingle(file):
|
def compileSingle(file):
|
||||||
Fparser.readfile(file)
|
fileBuffer = Fparser.readfile(file, True)
|
||||||
|
meshBuffer = Fparser.meshBuffer(fileBuffer, True)
|
||||||
|
Fwritter.grabScriptType(meshBuffer,True)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
|
|
||||||
App adder(){
|
App adder(){
|
||||||
|
|
||||||
int value1 = 0
|
int value1 = 1;
|
||||||
int value2 = 0
|
int value2 = 2;
|
||||||
|
|
||||||
print("total" + intToString(value1 + value2))
|
print("total" + intToString(value1 + value2));
|
||||||
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user