Skip to content

Commit

Permalink
Working on adding more shit
Browse files Browse the repository at this point in the history
  • Loading branch information
notzekkie committed Sep 26, 2024
1 parent d15d6d8 commit 51d2032
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
hello_world.rizz
*.rizz
*.rizzscript
24 changes: 15 additions & 9 deletions compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def syntax(code):
'ongod': 'true',
'bet': 'or',
'cook': 'input',
'ohio': 'import',
'fanumtax': 'import',
'diddy': 'try',
'goofy': 'for',
'ahh': 'for',
Expand All @@ -49,13 +49,22 @@ def syntax(code):
'pluh': 'while',
'ratio': 'elif',
'phonk': 'lambda'

}

for brainrot_word, python_word in translations.items():
code = code.replace(brainrot_word, python_word)

# Handle missing closing parentheses for print and input
lines = code.splitlines()
for i in range(len(lines)):
if lines[i].strip().startswith("print("):
if lines[i].count('(') > lines[i].count(')'):
lines[i] += ')'
elif lines[i].strip().startswith("input("):
if lines[i].count('(') > lines[i].count(')'):
lines[i] += ')'

return code
return "\n".join(lines)

file_path = input("Enter the path of your .rizz file: ")

Expand All @@ -64,12 +73,9 @@ def syntax(code):
brainrot_code = file.read()

python_code = syntax(brainrot_code)

exec(python_code)

function_name = python_code.split('(')[0].split()[-1]
exec(f'{function_name}()')


except Exception as e:
print("Error:", e)

0 comments on commit 51d2032

Please sign in to comment.