Compare commits
3 Commits
d802ca3e07
...
02a8686c37
| Author | SHA1 | Date |
|---|---|---|
|
|
02a8686c37 | |
|
|
7a13614992 | |
|
|
905ee1c277 |
10
README.md
10
README.md
|
|
@ -104,10 +104,12 @@ loop:
|
|||
or PC MP ZR
|
||||
```
|
||||
|
||||
## High Level Language
|
||||
*WIP*
|
||||
## High Level Language: *DuoDeca-Script*
|
||||
|
||||
About
|
||||

|
||||
|
||||
### About
|
||||
- Name: DuoDeca-Script
|
||||
- Paradigm: Multi-Paradigm: Procedural (Imperative), Structured
|
||||
- Designer: Kyler Olsen
|
||||
- Created: Mar 2024
|
||||
|
|
@ -115,7 +117,7 @@ About
|
|||
- Platform: ytd 12-bit computer,
|
||||
ytd 12-bit emulator (from *pytd12dk*, multi-platform)
|
||||
- License: MIT
|
||||
- Filename extension: `.ytd12c`
|
||||
- Filename extension: `.ytd12c`, `.duox`
|
||||
- Compiler Implementations: `pytd12dk` (Python),
|
||||
`ytd12nc` (*native compiler*)
|
||||
|
||||
|
|
|
|||
Binary file not shown.
|
After Width: | Height: | Size: 33 KiB |
|
|
@ -0,0 +1,110 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="150mm"
|
||||
height="175mm"
|
||||
viewBox="0 0 150 175"
|
||||
version="1.1"
|
||||
id="svg8"
|
||||
inkscape:version="1.0.1 (3bc2e813f5, 2020-09-07)"
|
||||
sodipodi:docname="Logo.svg">
|
||||
<defs
|
||||
id="defs2" />
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="0.35"
|
||||
inkscape:cx="399.99997"
|
||||
inkscape:cy="560"
|
||||
inkscape:document-units="mm"
|
||||
inkscape:current-layer="layer1"
|
||||
inkscape:document-rotation="0"
|
||||
showgrid="false"
|
||||
showguides="false"
|
||||
fit-margin-top="0"
|
||||
fit-margin-left="0"
|
||||
fit-margin-right="0"
|
||||
fit-margin-bottom="0"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1027"
|
||||
inkscape:window-x="-8"
|
||||
inkscape:window-y="-8"
|
||||
inkscape:window-maximized="1" />
|
||||
<metadata
|
||||
id="metadata5">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1">
|
||||
<path
|
||||
id="rect833"
|
||||
style="fill:#800080;stroke:none;stroke-width:1.40316;stroke-linecap:round"
|
||||
transform="rotate(45.000001)"
|
||||
d="M 141.42136,35.355337 70.710682,70.710674 53.033012,-53.033012 141.42136,35.355337"
|
||||
sodipodi:nodetypes="cccc" />
|
||||
<path
|
||||
id="rect833-3"
|
||||
style="fill:#ff00ff;stroke:none;stroke-width:1.40316;stroke-linecap:round"
|
||||
d="M 75,125 150,100 75,0 v 125"
|
||||
sodipodi:nodetypes="cccc" />
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-size:27px;line-height:0.75;font-family:'AR DESTINE';-inkscape-font-specification:'AR DESTINE';fill:none;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
x="97.599159"
|
||||
y="50.900482"
|
||||
id="text853"
|
||||
transform="matrix(0.83858353,0.30901699,-0.65517326,0.95105652,0,0)"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan851"
|
||||
x="97.599159"
|
||||
y="50.900482"
|
||||
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:27px;font-family:'Times New Roman';-inkscape-font-specification:'Times New Roman, Bold';text-align:center;text-anchor:middle;fill:none;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1">Duo</tspan><tspan
|
||||
sodipodi:role="line"
|
||||
x="97.599159"
|
||||
y="72.040573"
|
||||
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:27px;font-family:'Times New Roman';-inkscape-font-specification:'Times New Roman, Bold';text-align:center;text-anchor:middle;fill:none;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
id="tspan855">Deca</tspan></text>
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-size:40px;line-height:1.25;font-family:'AR DESTINE';-inkscape-font-specification:'AR DESTINE';stroke-width:0.264583"
|
||||
x="82.398804"
|
||||
y="204.86308"
|
||||
id="text861"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan859"
|
||||
x="82.398804"
|
||||
y="204.86308"
|
||||
style="font-style:normal;font-variant:normal;font-weight:100;font-stretch:normal;font-family:'AR DESTINE';-inkscape-font-specification:'AR DESTINE Thin';stroke-width:0.264583" /></text>
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-size:40px;line-height:1.25;font-family:'AR DESTINE';-inkscape-font-specification:'AR DESTINE';stroke-width:0.264583"
|
||||
x="16.062479"
|
||||
y="159.25784"
|
||||
id="text865"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan863"
|
||||
x="16.062479"
|
||||
y="159.25784"
|
||||
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:'Comic Sans MS';-inkscape-font-specification:'Comic Sans MS Bold';stroke-width:0.264583">Script</tspan></text>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 4.4 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 6.5 KiB |
|
|
@ -41,6 +41,7 @@ def parser(parser: argparse.ArgumentParser):
|
|||
def main(argv: Sequence[str] | None = None):
|
||||
parser = argparse.ArgumentParser(
|
||||
description='ytd 12-bit Computer Linker and Assembler',
|
||||
epilog='https://github.com/KylerOlsen/ytd_12-bit_computer',
|
||||
)
|
||||
|
||||
args = parser.parse_args(argv)
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@ def parser(parser: argparse.ArgumentParser):
|
|||
def main(argv: Sequence[str] | None = None):
|
||||
parser = argparse.ArgumentParser(
|
||||
description='ytd 12-bit Computer Compiler',
|
||||
epilog='https://github.com/KylerOlsen/ytd_12-bit_computer',
|
||||
)
|
||||
|
||||
args = parser.parse_args(argv)
|
||||
|
|
|
|||
|
|
@ -235,7 +235,7 @@ class CompoundIdentifier:
|
|||
def tree_str(self, pre: str = "", pre_cont: str = "") -> str:
|
||||
s: str = f"{pre} CompoundIdentifier\n"
|
||||
s += f"{pre_cont}├─ Owner\n"
|
||||
s += self._owner.tree_str(pre_cont + " ├─", pre_cont + " │ ")
|
||||
s += self._owner.tree_str(pre_cont + "│ └─", pre_cont + " ")
|
||||
s += f"{pre_cont}└─ Member\n"
|
||||
s += self._member.tree_str(pre_cont + " └─", pre_cont + " ")
|
||||
return s
|
||||
|
|
@ -478,12 +478,10 @@ class CodeBlock:
|
|||
self,
|
||||
pre: str = "",
|
||||
pre_cont: str = "",
|
||||
cont: bool = False,
|
||||
) -> str:
|
||||
s: str = ""
|
||||
if self._code:
|
||||
if cont: s += f"{pre}├─ Code\n"
|
||||
else: s += f"{pre}└─ Code\n"
|
||||
s += f"{pre} Code Block\n"
|
||||
for code in self._code[:-1]:
|
||||
s += code.tree_str(pre_cont + "├─", pre_cont + "│ ")
|
||||
s += self._code[-1].tree_str(pre_cont + "└─", pre_cont + " ")
|
||||
|
|
@ -645,9 +643,7 @@ class ElseBlock:
|
|||
def file_info(self) -> FileInfo: return self._file_info
|
||||
|
||||
def tree_str(self, pre: str = "", pre_cont: str = "") -> str:
|
||||
s: str = f"{pre} Else Block\n"
|
||||
s += self._code.tree_str(pre_cont + " ├─", pre_cont + " │ ")
|
||||
return s
|
||||
return self._code.tree_str(pre + " Else", pre_cont + "")
|
||||
|
||||
@staticmethod
|
||||
def _sa(
|
||||
|
|
@ -690,14 +686,13 @@ class ForPreDef:
|
|||
def identifier(self) -> Identifier: return self._identifier
|
||||
|
||||
def tree_str(self, pre: str = "", pre_cont: str = "") -> str:
|
||||
s: str = f"{pre} For Loop Pre-Definition: {self._identifier}\n"
|
||||
s: str = f"{pre} Definition: {self._identifier}\n"
|
||||
if self._assignment: s += f"{pre_cont}├─ Type: "
|
||||
else: s += f"{pre_cont}└─ Type: "
|
||||
if self._pointer: s+= "@"
|
||||
s += f"{self._type}\n"
|
||||
if self._assignment:
|
||||
s += f"{pre_cont}└─ Value\n"
|
||||
s += self._assignment.tree_str(pre_cont + " ├─", pre_cont + " │ ")
|
||||
s += self._assignment.tree_str(pre_cont + "└─ Value", pre_cont + " ")
|
||||
return s
|
||||
|
||||
|
||||
|
|
@ -731,25 +726,19 @@ class ForBlock:
|
|||
|
||||
def tree_str(self, pre: str = "", pre_cont: str = "") -> str:
|
||||
s: str = f"{pre} For Loop\n"
|
||||
if self._code or self._else is not None:
|
||||
cond_pre = f"{pre_cont}├─"
|
||||
cond_pre_cont = f"{pre_cont}│ "
|
||||
else:
|
||||
cond_pre = f"{pre_cont}└─"
|
||||
cond_pre_cont = f"{pre_cont} "
|
||||
s += f"{cond_pre} Pre-Statement\n"
|
||||
s += self._pre_statement.tree_str(
|
||||
cond_pre_cont + "└─", cond_pre_cont + " ")
|
||||
s += f"{cond_pre} Condition\n"
|
||||
f"{pre_cont}├─ Pre-Statement", f"{pre_cont}│ ")
|
||||
s += self._condition.tree_str(
|
||||
cond_pre_cont + "└─", cond_pre_cont + " ")
|
||||
s += f"{cond_pre} Post-Statement\n"
|
||||
f"{pre_cont}├─ Condition", f"{pre_cont}│ ")
|
||||
s += self._post_statement.tree_str(
|
||||
cond_pre_cont + "└─", cond_pre_cont + " ")
|
||||
s += self._code.tree_str(
|
||||
pre_cont + " ├─", pre_cont + " │ ", self._else is not None)
|
||||
f"{pre_cont}├─ Post-Statement", f"{pre_cont}│ ")
|
||||
if self._else is not None:
|
||||
s += self._code.tree_str(
|
||||
pre_cont + "├─", pre_cont + "│ ")
|
||||
s += self._else.tree_str(pre_cont + "└─", pre_cont + " ")
|
||||
else:
|
||||
s += self._code.tree_str(
|
||||
pre_cont + "└─", pre_cont + " ")
|
||||
return s
|
||||
|
||||
@staticmethod
|
||||
|
|
@ -822,16 +811,18 @@ class WhileBlock:
|
|||
def tree_str(self, pre: str = "", pre_cont: str = "") -> str:
|
||||
s: str = f"{pre} While Loop\n"
|
||||
if self._code or self._else is not None:
|
||||
s += f"{pre_cont}├─ Condition\n"
|
||||
cond_pre = f"{pre_cont}│ "
|
||||
s += self._condition.tree_str(
|
||||
f"{pre_cont}├─ Condition", f"{pre_cont}│ ")
|
||||
else:
|
||||
s += f"{pre_cont}└─ Condition\n"
|
||||
cond_pre = f"{pre_cont} "
|
||||
s += self._condition.tree_str(cond_pre + "└─", cond_pre + " ")
|
||||
s += self._code.tree_str(
|
||||
pre_cont + " ├─", pre_cont + " │ ", self._else is not None)
|
||||
s += self._condition.tree_str(
|
||||
f"{pre_cont}└─ Condition", f"{pre_cont} ")
|
||||
if self._else is not None:
|
||||
s += self._code.tree_str(
|
||||
pre_cont + "├─", pre_cont + "│ ")
|
||||
s += self._else.tree_str(pre_cont + "└─", pre_cont + " ")
|
||||
else:
|
||||
s += self._code.tree_str(
|
||||
pre_cont + "└─", pre_cont + " ")
|
||||
return s
|
||||
|
||||
@staticmethod
|
||||
|
|
@ -886,17 +877,20 @@ class DoBlock:
|
|||
def tree_str(self, pre: str = "", pre_cont: str = "") -> str:
|
||||
s: str = f"{pre} Do Loop\n"
|
||||
s += self._first_code.tree_str(
|
||||
pre_cont + " ├─", pre_cont + " │ ", True)
|
||||
pre_cont + "├─ First Do", pre_cont + "│ ")
|
||||
if self._second_code or self._else is not None:
|
||||
s += f"{pre_cont}├─ Condition\n"
|
||||
cond_pre = f"{pre_cont}│ "
|
||||
s += self._condition.tree_str(
|
||||
f"{pre_cont}├─ Condition", f"{pre_cont}│ ")
|
||||
else:
|
||||
s += f"{pre_cont}└─ Condition\n"
|
||||
cond_pre = f"{pre_cont} "
|
||||
s += self._condition.tree_str(cond_pre + "└─", cond_pre + " ")
|
||||
s += self._condition.tree_str(
|
||||
f"{pre_cont}└─ Condition", f"{pre_cont} ")
|
||||
if self._second_code is not None:
|
||||
if self._else is not None:
|
||||
s += self._second_code.tree_str(
|
||||
pre_cont + " ├─", pre_cont + " │ ", self._else is not None)
|
||||
pre_cont + "├─ Second Do", pre_cont + "│ ")
|
||||
else:
|
||||
s += self._second_code.tree_str(
|
||||
pre_cont + "└─ Second Do", pre_cont + " ")
|
||||
if self._else is not None:
|
||||
s += self._else.tree_str(pre_cont + "└─", pre_cont + " ")
|
||||
return s
|
||||
|
|
@ -950,14 +944,13 @@ class IfBlock:
|
|||
def tree_str(self, pre: str = "", pre_cont: str = "") -> str:
|
||||
s: str = f"{pre} If Statement\n"
|
||||
if self._code or self._else is not None:
|
||||
s += f"{pre_cont}├─ Condition\n"
|
||||
cond_pre = f"{pre_cont}│ "
|
||||
s += self._condition.tree_str(
|
||||
f"{pre_cont}├─ Condition", f"{pre_cont}│ ")
|
||||
else:
|
||||
s += f"{pre_cont}└─ Condition\n"
|
||||
cond_pre = f"{pre_cont} "
|
||||
s += self._condition.tree_str(cond_pre + "└─", cond_pre + " ")
|
||||
s += self._condition.tree_str(
|
||||
f"{pre_cont}└─ Condition", f"{pre_cont} ")
|
||||
s += self._code.tree_str(
|
||||
pre_cont + " ├─", pre_cont + " │ ", self._else is not None)
|
||||
pre_cont + "├─ If", pre_cont + "│ ")
|
||||
if self._else is not None:
|
||||
s += self._else.tree_str(pre_cont + "└─", pre_cont + " ")
|
||||
return s
|
||||
|
|
@ -1068,10 +1061,10 @@ class FunctionBlock:
|
|||
self._members
|
||||
):
|
||||
s += self._symbol_table.table_str(
|
||||
self.identifier.content, "├─", "│ ")
|
||||
self.identifier.content, pre_cont + "├─", pre_cont + "│ ")
|
||||
else:
|
||||
s += self._symbol_table.table_str(
|
||||
self.identifier.content, "└─", " ")
|
||||
self.identifier.content, pre_cont + "└─", pre_cont + " ")
|
||||
if self._params:
|
||||
if self._code or self._return_type is not None or self._members:
|
||||
s += f"{pre_cont}├─ Parameters\n"
|
||||
|
|
@ -1098,7 +1091,7 @@ class FunctionBlock:
|
|||
s += code.tree_str(pre_cont + " ├─", pre_cont + " │ ")
|
||||
s += self._members[-1].tree_str(
|
||||
pre_cont + " └─", pre_cont + " ")
|
||||
s += self._code.tree_str(pre_cont + " ├─", pre_cont + " │ ")
|
||||
s += self._code.tree_str(pre_cont + "└─ Function", pre_cont + " ")
|
||||
return s
|
||||
|
||||
@staticmethod
|
||||
|
|
|
|||
|
|
@ -1616,7 +1616,7 @@ class StructBlock:
|
|||
if self._members:
|
||||
for member in self._members[:-1]:
|
||||
s += member.tree_str(pre_cont + "├─", pre_cont + "│ ")
|
||||
s += self._members[-1].tree_str(pre_cont + "└─", pre_cont + "│ ")
|
||||
s += self._members[-1].tree_str(pre_cont + "└─", pre_cont + " ")
|
||||
return s
|
||||
|
||||
@staticmethod
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@ def main(argv: Sequence[str] | None = None):
|
|||
|
||||
parser = argparse.ArgumentParser(
|
||||
description='ytd 12-bit Computer Emulator',
|
||||
epilog='https://github.com/KylerOlsen/ytd_12-bit_computer',
|
||||
)
|
||||
parser.add_argument('rom_file', type=argparse.FileType('rb'))
|
||||
parser.add_argument(
|
||||
|
|
|
|||
|
|
@ -12,17 +12,33 @@ def main(argv: Sequence[str] | None = None):
|
|||
|
||||
parser = argparse.ArgumentParser(
|
||||
description='ytd 12-bit Development Kit',
|
||||
epilog='https://github.com/KylerOlsen/ytd_12-bit_computer',
|
||||
)
|
||||
|
||||
subparsers = parser.add_subparsers(required=True)
|
||||
|
||||
parser_emulator = subparsers.add_parser('em', help='Emulator help')
|
||||
parser_emulator = subparsers.add_parser(
|
||||
'em',
|
||||
description='ytd 12-bit Computer Emulator',
|
||||
help='Emulator help',
|
||||
epilog='https://github.com/KylerOlsen/ytd_12-bit_computer',
|
||||
)
|
||||
emulator_parser(parser_emulator)
|
||||
|
||||
parser_compiler = subparsers.add_parser('cm', help='Compiler help')
|
||||
parser_compiler = subparsers.add_parser(
|
||||
'cm',
|
||||
description='ytd 12-bit Computer Compiler',
|
||||
help='Compiler help',
|
||||
epilog='https://github.com/KylerOlsen/ytd_12-bit_computer',
|
||||
)
|
||||
compiler_parser(parser_compiler)
|
||||
|
||||
parser_assembler = subparsers.add_parser('am', help='Assembler help')
|
||||
parser_assembler = subparsers.add_parser(
|
||||
'am',
|
||||
description='ytd 12-bit Computer Linker and Assembler',
|
||||
help='Assembler help',
|
||||
epilog='https://github.com/KylerOlsen/ytd_12-bit_computer',
|
||||
)
|
||||
assembler_parser(parser_assembler)
|
||||
|
||||
args = parser.parse_args(argv)
|
||||
|
|
|
|||
Loading…
Reference in New Issue