This repository has been archived by the owner on Aug 7, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
LonnonjamesD
authored and
LonnonjamesD
committed
May 2, 2021
1 parent
ffe82db
commit 852584f
Showing
7 changed files
with
201 additions
and
154 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# -*- mode: python ; coding: utf-8 -*- | ||
|
||
|
||
block_cipher = None | ||
|
||
|
||
a = Analysis(['main.py'], | ||
pathex=['E:\\Coding Shit\\Solis'], | ||
binaries=[], | ||
datas=[], | ||
hiddenimports=[], | ||
hookspath=[], | ||
runtime_hooks=[], | ||
excludes=[], | ||
win_no_prefer_redirects=False, | ||
win_private_assemblies=False, | ||
cipher=block_cipher, | ||
noarchive=False) | ||
pyz = PYZ(a.pure, a.zipped_data, | ||
cipher=block_cipher) | ||
exe = EXE(pyz, | ||
a.scripts, | ||
a.binaries, | ||
a.zipfiles, | ||
a.datas, | ||
[], | ||
name='main', | ||
debug=False, | ||
bootloader_ignore_signals=False, | ||
strip=False, | ||
upx=True, | ||
upx_exclude=[], | ||
runtime_tmpdir=None, | ||
console=True ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
|
||
#-----------------------------------------------------------------| | ||
#- | | ||
#- Built in Functions | | ||
#- | | ||
#-----------------------------------------------------------------| | ||
|
||
#& Prints text without a newline | ||
def outFUNC(text): | ||
text = text.replace("\\n", "\n") | ||
print(f"{text}", end='') | ||
|
||
#& Prints text with a new line at the end | ||
def outlnFUNC(text): | ||
text = text.replace("\\n", "\n") | ||
print(f"{text}", end='\n') | ||
|
||
#& Exits the program | ||
def vent(): | ||
try: | ||
def wait(): | ||
m.getch() | ||
print("\n\nPress any key to continue...") | ||
wait() | ||
except: | ||
os.system('read -s -n 1 -p "Press any key to continue..."') | ||
exit() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
from src.tokens import tokens, tokensdict | ||
|
||
#* Pairs function from lua | ||
def pairs(o): | ||
if isinstance(o, dict): | ||
return o.items() | ||
else: | ||
return enumerate(o) | ||
|
||
|
||
#-----------------------------------------------------------------| | ||
#- | | ||
#- Lexer & Tokenizier | | ||
#- | | ||
#-----------------------------------------------------------------| | ||
|
||
#* This turns the code into a Lexed List that the Parser can understand and run | ||
def Lexer(text): | ||
for i, index in pairs(text): | ||
text[i] = text[i].rstrip("\n") | ||
iterate = 0 | ||
Lexed = [] | ||
while iterate != len(text): | ||
check = "" | ||
for char in text[iterate]: | ||
check += char | ||
if check in tokens: | ||
if check == "out": | ||
if text[iterate][0:5] == "outln": | ||
Lexed += ["outln"] | ||
check = "" | ||
else: | ||
Lexed += [check] | ||
check = "" | ||
else: | ||
Lexed += [check] | ||
check = "" | ||
elif char in tokens: | ||
#_ This gets the value inside of the of the Quotes | ||
if char == '"' and Lexed[-1] == '"': | ||
Lexed[-1] = "" | ||
Lexed += [f"{check[:-1]}/S"] | ||
check = "" | ||
#_ Get's the inline var, var name | ||
elif char == '|' and Lexed[-1] == '|': | ||
Lexed[-1] = "" | ||
Lexed += [f"{check[:-1]}/V"] | ||
check = "" | ||
#_ Get Assignment operator and name of the var | ||
elif char == "=": | ||
Final = check | ||
Final == Final[:-3] | ||
Final = Final.replace(" ", "") | ||
Final = Final.split("=") | ||
Final[1] = "=" | ||
Lexed += Final | ||
check = "" | ||
else: | ||
Lexed += [char] | ||
check = "" | ||
iterate += 1 | ||
Tokenizied = Tokinzier(Lexed) | ||
return Tokenizied | ||
|
||
#* This tokenizes to make it understandable for the Parser | ||
def Tokinzier(Lexed): | ||
iterate = 0 | ||
Tokenized = [] | ||
while iterate != len(Lexed): | ||
try: | ||
Tokenized += [[Lexed[iterate], tokensdict[Lexed[iterate]]]] | ||
except: | ||
LexedEnd = Lexed[iterate][-2:] | ||
if LexedEnd == "/S": | ||
Final = Lexed[iterate] | ||
Final = Final[:-2] | ||
Tokenized += [[Final, "STRING"]] | ||
elif LexedEnd == "/V": | ||
Final = Lexed[iterate] | ||
Final = Final[:-2] | ||
Tokenized += [[Final, "VAR"]] | ||
elif Lexed[iterate-1] == "var": | ||
Tokenized += [[Lexed[iterate], "VARNAME"]] | ||
iterate += 1 | ||
return Tokenized |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
from src.builtins import * | ||
|
||
#-----------------------------------------------------------------| | ||
#- | | ||
#- Parser | | ||
#- | | ||
#-----------------------------------------------------------------| | ||
|
||
#* This checks the Lexed code and parses it and runs it | ||
def Parser(text): | ||
iterate = 0 | ||
while iterate != len(text): | ||
#_ Look for the word out and make sure it has the type of FUNC | ||
if text[iterate][1] == "FUNC": | ||
if text[iterate+1][1] == "STRING" and not text[iterate+1][0] == '"': | ||
if text[iterate][0] == "out": | ||
outFUNC(text[iterate+1][0]) | ||
elif text[iterate][0] == "outln": | ||
outlnFUNC(text[iterate+1][0]) | ||
elif text[iterate+1][1] == "STRING" and text[iterate+1][0] == '"': | ||
print(f"""\rToo Little or Too many \"'s at | ||
{text[iterate][0]} {text[iterate+1][0]}\n""") | ||
#_ Look for the word vent and make sure it has the type of FUNC | ||
elif text[iterate][0] == "vent": | ||
vent() | ||
#_ Look for the word var and make sure it has the type of DECLARE | ||
elif text[iterate][0] == "var" and text[iterate][1] == "DECLARE": | ||
print() | ||
iterate += 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
tokens = [ | ||
"out", | ||
'"', | ||
"outln", | ||
"vent", | ||
"var", | ||
"=", | ||
"|" | ||
] | ||
tokensdict = { | ||
"out": "FUNC", | ||
'"': "STRING", | ||
"outln": "FUNC", | ||
"vent": "FUNC", | ||
"var": "DECLARE", | ||
"=": "ASSIGNMENT", | ||
"|": "VARUSE" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
var yourmom = "hello" | ||
outln """ | ||
outln |yourmom| |