Small changes
This commit is contained in:
parent
d9b891216d
commit
b950ff80a2
|
@ -107,6 +107,10 @@ loop:
|
||||||
## High Level Language: *DuoDeca-Script*
|
## High Level Language: *DuoDeca-Script*
|
||||||
|
|
||||||

|

|
||||||
|
<br/><small>
|
||||||
|
Yes, you may cringe that I used Comic Sans in my logo.
|
||||||
|
I do when others do so. <3 Kyler
|
||||||
|
</small>
|
||||||
|
|
||||||
### About
|
### About
|
||||||
- Name: DuoDeca-Script
|
- Name: DuoDeca-Script
|
||||||
|
|
|
@ -9,7 +9,6 @@ from .lexer import lexer
|
||||||
from .syntactical_analyzer import syntactical_analyzer
|
from .syntactical_analyzer import syntactical_analyzer
|
||||||
from .semantical_analyzer import semantical_analyzer
|
from .semantical_analyzer import semantical_analyzer
|
||||||
|
|
||||||
|
|
||||||
def _compile(args: argparse.Namespace):
|
def _compile(args: argparse.Namespace):
|
||||||
tokens = lexer(args.input_file.read(), args.input_file.name)
|
tokens = lexer(args.input_file.read(), args.input_file.name)
|
||||||
|
|
||||||
|
@ -40,13 +39,15 @@ def compile(args: argparse.Namespace):
|
||||||
def parser(parser: argparse.ArgumentParser):
|
def parser(parser: argparse.ArgumentParser):
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'input_file', type=argparse.FileType('r', encoding='utf-8'))
|
'input_file', type=argparse.FileType('r', encoding='utf-8'))
|
||||||
# parser.add_argument('-o', '--output_file', type=argparse.FileType('wb'))
|
parser.add_argument('-o', '--output_file', type=argparse.FileType('wb'))
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'-t', '--token_file', type=argparse.FileType('w', encoding='utf-8'))
|
'-t', '--token_file', type=argparse.FileType('w', encoding='utf-8'))
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'-x', '--syntax_file', type=argparse.FileType('w', encoding='utf-8'))
|
'-x', '--syntax_file', type=argparse.FileType('w', encoding='utf-8'))
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'-n', '--annotated_file', type=argparse.FileType('w', encoding='utf-8'))
|
'-n', '--annotated_file', type=argparse.FileType('w', encoding='utf-8'))
|
||||||
|
parser.add_argument(
|
||||||
|
'-a', '--assembly_file', type=argparse.FileType('w', encoding='utf-8'))
|
||||||
parser.set_defaults(func=compile)
|
parser.set_defaults(func=compile)
|
||||||
|
|
||||||
def main(argv: Sequence[str] | None = None):
|
def main(argv: Sequence[str] | None = None):
|
||||||
|
|
|
@ -1207,7 +1207,6 @@ class File:
|
||||||
symbol_table.add(symbol)
|
symbol_table.add(symbol)
|
||||||
for child in syntax_tree.children:
|
for child in syntax_tree.children:
|
||||||
new_child: (
|
new_child: (
|
||||||
syntactical_analyzer.Directive |
|
|
||||||
syntactical_analyzer.StructBlock |
|
syntactical_analyzer.StructBlock |
|
||||||
FunctionBlock |
|
FunctionBlock |
|
||||||
syntactical_analyzer.EnumBlock
|
syntactical_analyzer.EnumBlock
|
||||||
|
@ -1217,11 +1216,13 @@ class File:
|
||||||
symbol_table.get(
|
symbol_table.get(
|
||||||
child.identifier.content
|
child.identifier.content
|
||||||
)._definition = new_child # type: ignore
|
)._definition = new_child # type: ignore
|
||||||
|
# TODO: analyze structs
|
||||||
|
elif isinstance(child, syntactical_analyzer.StructBlock):
|
||||||
|
new_child = child
|
||||||
elif isinstance(child, syntactical_analyzer.EnumBlock):
|
elif isinstance(child, syntactical_analyzer.EnumBlock):
|
||||||
new_child = _sa_enum(child)
|
new_child = _sa_enum(child)
|
||||||
# TODO: analyze structs
|
elif isinstance(child, syntactical_analyzer.Directive):
|
||||||
else:
|
continue
|
||||||
new_child = child
|
|
||||||
children.append(new_child)
|
children.append(new_child)
|
||||||
file = File(children, syntax_tree._file_info, symbol_table)
|
file = File(children, syntax_tree._file_info, symbol_table)
|
||||||
return file
|
return file
|
||||||
|
|
Loading…
Reference in New Issue