-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rewrote the lexer, parser, generator, and linker (#2)
- Loading branch information
Showing
17 changed files
with
2,235 additions
and
1,317 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 |
---|---|---|
@@ -1,7 +1,5 @@ | ||
for (i = 0; i < @links; i += 1) { | ||
getlink(building, i) | ||
|
||
print(building) | ||
print(getlink(i)) | ||
print("\n") | ||
} | ||
|
||
|
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,19 +1,33 @@ | ||
from .lexer import Lexer | ||
from .preprocess import Preprocessor | ||
from .parser_ import Parser | ||
# from .lexer import Lexer | ||
# from .preprocess import Preprocessor | ||
# from .parser_ import Parser | ||
# from .error import MlogError | ||
# from .linker import Linker | ||
# from .optimizer import Optimizer | ||
|
||
tokens = Lexer.lex(Preprocessor.preprocess(""" | ||
print.ab("Hello, World!") | ||
const _2a = (cell1[1.5] * a) | ||
a = 1 | ||
a += 2 | ||
print(1 + _2a) | ||
for (i = 0; i < 10; i += 1) { | ||
print(i) | ||
} | ||
printflush(message1) | ||
""")) | ||
print("\n".join(map(repr, tokens))) | ||
print(Parser().parse(tokens)) | ||
# tokens = Lexer.lex(Preprocessor.preprocess(""" | ||
# print("Hello, World!") | ||
# const _2a = (cell1[3] * a) | ||
# cell1.enabled = cell1.x | ||
# a = 1 | ||
# a += 2 | ||
# print(1 + _2a) | ||
# if (1 > 2) { | ||
# print("1 > 2") | ||
# } else { | ||
# for (i = 0; i < 10; i += 1) { | ||
# print(i) | ||
# } | ||
# } | ||
# printflush(message1) | ||
# draw.color(255, 255, 255, 127) | ||
# """)) | ||
# # print("\n".join(map(str, tokens))) | ||
# ast = Parser().parse(tokens) | ||
# try: | ||
# print(Linker.link([Optimizer.optimize(ast.generate())])) | ||
# except MlogError as e: | ||
# e.print() | ||
# raise e | ||
|
||
# from . import cli | ||
from . import cli |
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
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 |
---|---|---|
|
@@ -11,4 +11,4 @@ class Format: | |
|
||
RESET = "\033[0m" | ||
|
||
ERROR = "\033[1m\033[91m" | ||
ERROR = "\033[91m" |
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
Oops, something went wrong.