Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DRAFT] Make an interpreter for this abomination #74

Open
wants to merge 78 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
2ffb75a
Groundwork
Bytestorm5 Jun 4, 2023
5aa5b4a
typo
Bytestorm5 Jun 4, 2023
7dc2119
tokenizer nearly done?
Bytestorm5 Jun 4, 2023
d32846c
mobile coding???????
Bytestorm5 Jun 4, 2023
75ead99
added more yelling
Bytestorm5 Jun 4, 2023
2a9fb21
newline and debugging
Bytestorm5 Jun 4, 2023
f68141e
Merge pull request #1 from TodePond/main
Bytestorm5 Jun 5, 2023
7aba489
very indecisive about the naming
Bytestorm5 Jun 5, 2023
347110d
Merge branch 'main' of https://github.com/Bytestorm5/DreamBerd
Bytestorm5 Jun 5, 2023
1d3a98d
forgot to save
Bytestorm5 Jun 5, 2023
23407e7
tokenizer probably works
Bytestorm5 Jun 5, 2023
50732c2
Put Tokenizer in a box
Bytestorm5 Jun 5, 2023
e678549
Tokenizer error handling
Bytestorm5 Jun 5, 2023
c52f87b
Generalize crawler to hopefully make parsing easier
Bytestorm5 Jun 5, 2023
448aef7
Improved AI
Bytestorm5 Jun 5, 2023
7a558c2
Implicit AI with newlines
Bytestorm5 Jun 5, 2023
d3c5655
Added Americentrism
Bytestorm5 Jun 5, 2023
25bd3ad
Removed Americentrism
Bytestorm5 Jun 5, 2023
2be54ab
Merge branch 'TodePond:main' into main
Bytestorm5 Jun 5, 2023
0ccea99
Added className and other misc changes
Bytestorm5 Jun 5, 2023
d392846
Individual tokens for Exclamations
Bytestorm5 Jun 5, 2023
d9320f5
totally didn't forget boolean operators who would do that not this gu…
Bytestorm5 Jun 5, 2023
6ab9618
Merge branch 'TodePond:main' into main
Bytestorm5 Jun 5, 2023
806a8b3
Check for internet connection
Bytestorm5 Jun 6, 2023
2f0f120
Parser groundwork
Bytestorm5 Jun 6, 2023
c074a2f
Improved "FUNCTION" keyword checks.
Odinmylord Jun 6, 2023
872ba48
Reformatted file.
Odinmylord Jun 6, 2023
62b2214
Update template.tsx
Bytestorm5 Jun 6, 2023
64f17fe
REGEX REGEX REGEX REGEX REGEX REGEX REGEX REGEX REGEX REGEX REGEX REGEX
Bytestorm5 Jun 6, 2023
dfede24
Made the regex even more cursed, now matches triple const
Odinmylord Jun 7, 2023
2865c10
Started implementing single line function declaration
Odinmylord Jun 7, 2023
0ae9440
Fixed the regex (splitting it in multiple lines wasn't a good idea) a…
Odinmylord Jun 7, 2023
11881fc
Fixed small issue with indentation
Odinmylord Jun 7, 2023
d82fd46
Fixed issues with variable assignment and function keyword
Odinmylord Jun 7, 2023
df530c0
Re-enable identification requirement && Lifetime functionality in com…
Bytestorm5 Jun 8, 2023
7917404
it is way too late to figure out time travel
Bytestorm5 Jun 8, 2023
5493a41
Preparing for chicanery
Bytestorm5 Jun 8, 2023
5a0a0e8
Variables tracked in a map now for greater flexibility
Bytestorm5 Jun 8, 2023
9036f89
This is a first try to check function syntax it isn't complete yet
Odinmylord Jun 8, 2023
ccaf1a4
some processor functions
Bytestorm5 Jun 8, 2023
efac972
Wrap expr in get_var
Bytestorm5 Jun 8, 2023
3445a8d
forgot to delete a keyword
Bytestorm5 Jun 8, 2023
265a27f
Dynamically determine if quotes are needed
Bytestorm5 Jun 8, 2023
645885a
expressions are hard
Bytestorm5 Jun 9, 2023
b7c0580
Merge remote-tracking branch 'origin/main' into functions
Odinmylord Jun 9, 2023
babf1d2
Added indentation check and fixed issue with newlines on linux
Odinmylord Jun 12, 2023
9082e9c
Now the script works with python 3.8+
Odinmylord Jun 12, 2023
945b278
almost finished parsing expressions
Bytestorm5 Jun 13, 2023
e3d7fab
why was I parsing to begin with?
Bytestorm5 Jun 13, 2023
4036885
Revert "why was I parsing to begin with?"
Bytestorm5 Jun 13, 2023
336ccac
Figured out parsing but do exponents *really* have to be right-associ…
Bytestorm5 Jun 13, 2023
04165bc
Finished expression parsing except for right associativity
Bytestorm5 Jun 13, 2023
a3bc397
Line preprocessor now solves precise equalities
Bytestorm5 Jun 13, 2023
08cae0c
Moved condition block manager to helper file
Bytestorm5 Jun 13, 2023
91dd845
keeping equality check simple for now, might change
Bytestorm5 Jun 13, 2023
ee6b452
Moved precise equality to expr processor
Bytestorm5 Jun 13, 2023
f218614
When check conditions and advanced variable geting
Bytestorm5 Jun 13, 2023
d88389b
We have some sort of function syntax check
Odinmylord Jun 13, 2023
92f60d7
Added const const var to invalid mix
Odinmylord Jun 13, 2023
aceda74
Merge pull request #2 from Bytestorm5/functions
Bytestorm5 Jun 13, 2023
8155a62
Recursive scoping
Bytestorm5 Jun 13, 2023
08c55da
Added type identifiers (they don't do anything)
Bytestorm5 Jun 13, 2023
11e4722
All functions lead to arrows
Bytestorm5 Jun 13, 2023
91a11b4
attempt at block handling
Bytestorm5 Jun 13, 2023
c06b6df
fix(compiler): variable declaration statements
gabrielchl Jun 22, 2023
8f71680
Add slots and fix type annotations
CoolCat467 Jun 22, 2023
3fd1c02
Add pyproject.toml for dependancies and mypy flags
CoolCat467 Jun 22, 2023
793ef9b
Merge pull request #3 from gabrielchl/main
Bytestorm5 Jun 22, 2023
fd84740
Merge branch 'pr/4'
Bytestorm5 Jun 22, 2023
2fd43e7
Merge pull request #5 from TodePond/main
Bytestorm5 Jun 22, 2023
03dc576
"serious" compiler boilerplate
Bytestorm5 Jun 23, 2023
baa183a
Reduce code duplication
CoolCat467 Jun 23, 2023
59701a6
Add code formatting
CoolCat467 Jun 23, 2023
ff68d1d
Revert "Reduce code duplication", wrong branch
CoolCat467 Jun 23, 2023
78255b8
refactor
Bytestorm5 Jun 23, 2023
f1c62af
feat: use filepath from args
gabrielchl Jun 23, 2023
6dbda7d
Merge pull request #8 from gabrielchl/feat-filepath-from-args
Bytestorm5 Jun 23, 2023
435eba3
Merge pull request #7 from CoolCat467/add-formatting
Bytestorm5 Jun 23, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/compinterpret.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
from codecs import decode
import gettext
from io import TextIOWrapper
import os
import locale

tokens = ["STRING", "NOT", "!", "IF", 'ELSE', '(', ')', '[', ']', 'TRUE', 'FALSE', 'CONST', 'VAR', '<', '>', 'INT', 'REAL', 'INFINITY', 'FUNCTION', 'PREVIOUS',
'NEXT', 'AWAIT', 'NEW_FILE', 'EXPORT', 'TO', 'CLASS', 'NEW', '.', 'USE', 'PLUS', 'MINUS', 'MULTIPLY', 'DIVIDE', '=', 'IDENTIFIER', 'INDENT',
'SPACE', 'DELETE', 'EOF', 'NEWLINE', '{', '}', 'INC', 'DEC', 'LOOSE_EQUALITY', 'PRECISE_EQUALITY', 'LITERAL_EQUALITY', 'ERROR']
'SPACE', 'DELETE', 'EOF', 'NEWLINE', '{', '}', 'INC', 'DEC', 'LOOSE_EQUALITY', 'PRECISE_EQUALITY', 'LITERAL_EQUALITY', 'ERROR', 'CURRENCY']
locale.setlocale(locale.LC_ALL, '')

class Token():
def __init__(self, token: str, lexeme: str) -> None:
Expand Down Expand Up @@ -59,6 +62,11 @@ def __init__(self) -> None:
'}': '}'
}

regional_currency = locale.localeconv()['currency_symbol']
if regional_currency == '':
# Americentrisim, baby 😎🦅🔫🔫🦅🦅🦅🔫🦅 🦅🔫🔫🔫🦅🔫🦅🔫 🦅🔫🔫🔫🦅🦅🔫🔫 🦅🔫🔫🦅🔫🦅🦅🦅 🦅🦅🔫🦅🦅🦅🦅🦅 🦅🔫🔫🦅🦅🔫🦅🦅 🦅🔫🔫🦅🔫🦅🦅🔫 🦅🔫🔫🦅🦅🔫🦅🦅 🦅🦅🔫🦅🦅🦅🦅🦅 🦅🦅🔫🔫🔫🦅🦅🔫 🦅🦅🔫🦅🔫🔫🔫🔫 🦅🦅🔫🔫🦅🦅🦅🔫 🦅🦅🔫🔫🦅🦅🦅🔫😎
regional_currency = '$'
self.basic_mappings[regional_currency] = 'CURRENCY'

def is_fn_subset(self, string):
target = "FUNCTION"
Expand Down