Skip to content
This repository has been archived by the owner on Aug 7, 2023. It is now read-only.

Commit

Permalink
BetterBuild
Browse files Browse the repository at this point in the history
  • Loading branch information
LonnonjamesD authored and LonnonjamesD committed May 2, 2021
1 parent b05504b commit aa26aff
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 31 deletions.
Binary file modified __pycache__/main.cpython-39.pyc
Binary file not shown.
2 changes: 2 additions & 0 deletions buildexe.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@ECHO OFF
echo toggle = True > onoff.py
pyinstaller --onefile main.py
echo toggle = False > onoff.py
pause
16 changes: 9 additions & 7 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from src.lexer import Lexer
from src.parser import Parser
from onoff import toggle

try:
f = (open(str(sys.argv[1]), "r"))
Expand All @@ -24,10 +25,11 @@
print(LexedVersion)
Parser(LexedVersion)
#time.sleep(10)
"""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..."')"""
if toggle == True:
try:
def wait():
m.getch()
print("\nPress any key to continue...")
wait()
except:
os.system('read -s -n 1 -p "Press any key to continue..."')
1 change: 1 addition & 0 deletions onoff.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
toggle = False
15 changes: 7 additions & 8 deletions src/builtins.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import sys
import msvcrt as m
import time

#-----------------------------------------------------------------|
#- |
Expand All @@ -17,11 +20,7 @@ def outlnFUNC(text):

#& 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()
exit()

def declarevar(var):
print()
24 changes: 14 additions & 10 deletions src/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,22 @@ def Parser(text):
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""")
try:
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""")
except:
pass
#_ Look for the word vent and make sure it has the type of FUNC
elif text[iterate][0] == "vent":
if 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()
print(text[iterate])
declarevar(text[iterate])
iterate += 1
4 changes: 2 additions & 2 deletions src/tokens.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
'"',
"outln",
"vent",
"var",
"var ",
"=",
"|"
]
Expand All @@ -12,7 +12,7 @@
'"': "STRING",
"outln": "FUNC",
"vent": "FUNC",
"var": "DECLARE",
"var ": "DECLARE",
"=": "ASSIGNMENT",
"|": "VARUSE"
}
2 changes: 1 addition & 1 deletion start.bat
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@ECHO OFF
:start
python main.py

echo.
pause
cls
goto start
6 changes: 3 additions & 3 deletions text.sol
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
var yourmom = "hello"
outln """
outln |yourmom|
var urmom = "test"
out "test"
vent

0 comments on commit aa26aff

Please sign in to comment.