-
Notifications
You must be signed in to change notification settings - Fork 0
/
Monty Project.drawio
175 lines (175 loc) · 15.9 KB
/
Monty Project.drawio
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
<mxfile host="app.diagrams.net" modified="2023-12-17T08:20:05.284Z" agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36" etag="NaYvjscB27cI4Wk-S1Tj" version="22.1.8" type="github">
<diagram id="C5RBs43oDa-KdzZeNtuy" name="Page-1">
<mxGraphModel dx="836" dy="1296" grid="0" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1169" pageHeight="827" math="0" shadow="1">
<root>
<mxCell id="WIyWlLk6GJQsqaUBKTNV-0" />
<mxCell id="WIyWlLk6GJQsqaUBKTNV-1" parent="WIyWlLk6GJQsqaUBKTNV-0" />
<mxCell id="0wCFsdbysDWYnxFJeVAg-2" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="0wCFsdbysDWYnxFJeVAg-0">
<mxGeometry relative="1" as="geometry">
<mxPoint x="125" y="100" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="0wCFsdbysDWYnxFJeVAg-0" value="START" style="rounded=1;whiteSpace=wrap;html=1;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
<mxGeometry x="90" y="40" width="70" height="20" as="geometry" />
</mxCell>
<mxCell id="0wCFsdbysDWYnxFJeVAg-4" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" target="0wCFsdbysDWYnxFJeVAg-3">
<mxGeometry relative="1" as="geometry">
<mxPoint x="125" y="150" as="sourcePoint" />
</mxGeometry>
</mxCell>
<mxCell id="0wCFsdbysDWYnxFJeVAg-9" value="Check count of args" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];rounded=1;" vertex="1" connectable="0" parent="0wCFsdbysDWYnxFJeVAg-4">
<mxGeometry x="-0.24" y="1" relative="1" as="geometry">
<mxPoint as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="0wCFsdbysDWYnxFJeVAg-7" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="0wCFsdbysDWYnxFJeVAg-3" target="0wCFsdbysDWYnxFJeVAg-5">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="0wCFsdbysDWYnxFJeVAg-10" value="No" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];rounded=1;" vertex="1" connectable="0" parent="0wCFsdbysDWYnxFJeVAg-7">
<mxGeometry y="-1" relative="1" as="geometry">
<mxPoint as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="0wCFsdbysDWYnxFJeVAg-13" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="0wCFsdbysDWYnxFJeVAg-3" target="0wCFsdbysDWYnxFJeVAg-12">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="0wCFsdbysDWYnxFJeVAg-33" value="Yes" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];rounded=1;" vertex="1" connectable="0" parent="0wCFsdbysDWYnxFJeVAg-13">
<mxGeometry x="0.4095" relative="1" as="geometry">
<mxPoint as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="0wCFsdbysDWYnxFJeVAg-3" value="args != 2" style="rhombus;whiteSpace=wrap;html=1;rounded=1;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
<mxGeometry x="90" y="200" width="70" height="70" as="geometry" />
</mxCell>
<mxCell id="0wCFsdbysDWYnxFJeVAg-5" value="Print usage error and exit failure" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#a20025;fontColor=#ffffff;strokeColor=#6F0000;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
<mxGeometry x="205" y="210" width="75" height="50" as="geometry" />
</mxCell>
<mxCell id="0wCFsdbysDWYnxFJeVAg-16" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="0wCFsdbysDWYnxFJeVAg-12" target="0wCFsdbysDWYnxFJeVAg-14">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="0wCFsdbysDWYnxFJeVAg-19" value="No" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];rounded=1;" vertex="1" connectable="0" parent="0wCFsdbysDWYnxFJeVAg-16">
<mxGeometry x="-0.2" y="2" relative="1" as="geometry">
<mxPoint as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="0wCFsdbysDWYnxFJeVAg-17" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="0wCFsdbysDWYnxFJeVAg-12" target="0wCFsdbysDWYnxFJeVAg-31">
<mxGeometry relative="1" as="geometry">
<mxPoint x="125" y="410" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="0wCFsdbysDWYnxFJeVAg-18" value="Yes" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];rounded=1;" vertex="1" connectable="0" parent="0wCFsdbysDWYnxFJeVAg-17">
<mxGeometry x="0.28" relative="1" as="geometry">
<mxPoint y="-6" as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="0wCFsdbysDWYnxFJeVAg-12" value="arg[1] is a valid file?" style="rhombus;whiteSpace=wrap;html=1;rounded=1;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
<mxGeometry x="90" y="307.5" width="70" height="70" as="geometry" />
</mxCell>
<mxCell id="0wCFsdbysDWYnxFJeVAg-14" value="Print can't open file error and exit failure" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#a20025;fontColor=#ffffff;strokeColor=#6F0000;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
<mxGeometry x="205" y="315" width="75" height="55" as="geometry" />
</mxCell>
<mxCell id="0wCFsdbysDWYnxFJeVAg-21" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="175" y="441" as="sourcePoint" />
<mxPoint x="300" y="440" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="0wCFsdbysDWYnxFJeVAg-22" value="Read each&nbsp;<br>line of the<br>file into a<br>linked list" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];rounded=1;" vertex="1" connectable="0" parent="0wCFsdbysDWYnxFJeVAg-21">
<mxGeometry x="-0.1265" relative="1" as="geometry">
<mxPoint as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="0wCFsdbysDWYnxFJeVAg-27" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="0wCFsdbysDWYnxFJeVAg-20" target="0wCFsdbysDWYnxFJeVAg-25">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="0wCFsdbysDWYnxFJeVAg-29" value="No" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];rounded=1;" vertex="1" connectable="0" parent="0wCFsdbysDWYnxFJeVAg-27">
<mxGeometry x="-0.1059" y="-1" relative="1" as="geometry">
<mxPoint as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="0wCFsdbysDWYnxFJeVAg-28" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="0wCFsdbysDWYnxFJeVAg-20">
<mxGeometry relative="1" as="geometry">
<mxPoint x="414" y="440.1" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="0wCFsdbysDWYnxFJeVAg-30" value="Yes" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];rounded=1;" vertex="1" connectable="0" parent="0wCFsdbysDWYnxFJeVAg-28">
<mxGeometry x="-0.15" y="1" relative="1" as="geometry">
<mxPoint as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="0wCFsdbysDWYnxFJeVAg-20" value="Valid args?" style="rhombus;whiteSpace=wrap;html=1;rounded=1;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
<mxGeometry x="300" y="405" width="60" height="70" as="geometry" />
</mxCell>
<mxCell id="0wCFsdbysDWYnxFJeVAg-25" value="Print invalid<br>args error and exit failure" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#a20025;fontColor=#ffffff;strokeColor=#6F0000;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
<mxGeometry x="292.5" y="315.01" width="75" height="55" as="geometry" />
</mxCell>
<mxCell id="0wCFsdbysDWYnxFJeVAg-49" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;strokeColor=#23445D;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" target="0wCFsdbysDWYnxFJeVAg-48">
<mxGeometry relative="1" as="geometry">
<mxPoint x="480" y="440.1" as="sourcePoint" />
</mxGeometry>
</mxCell>
<mxCell id="0wCFsdbysDWYnxFJeVAg-31" value="<font style="font-size: 10px;">Open the file in the read mode and parse the content</font>" style="shape=document;whiteSpace=wrap;html=1;boundedLbl=1;rounded=1;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
<mxGeometry x="75" y="412" width="100" height="58" as="geometry" />
</mxCell>
<mxCell id="0wCFsdbysDWYnxFJeVAg-32" value="Receive&nbsp;<br>Command from<br>CLI" style="shape=parallelogram;perimeter=parallelogramPerimeter;whiteSpace=wrap;html=1;fixedSize=1;rounded=1;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
<mxGeometry x="67.5" y="100" width="115" height="50" as="geometry" />
</mxCell>
<mxCell id="0wCFsdbysDWYnxFJeVAg-67" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="0wCFsdbysDWYnxFJeVAg-48" target="0wCFsdbysDWYnxFJeVAg-61">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="0wCFsdbysDWYnxFJeVAg-48" value="Compare opcode with predefined opcodes" style="rounded=1;whiteSpace=wrap;html=1;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
<mxGeometry x="540" y="408.13" width="70" height="63.75" as="geometry" />
</mxCell>
<mxCell id="0wCFsdbysDWYnxFJeVAg-52" value="Extract the opcode and arg" style="shape=process;whiteSpace=wrap;html=1;backgroundOutline=1;rounded=1;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
<mxGeometry x="414" y="410" width="80" height="60" as="geometry" />
</mxCell>
<mxCell id="0wCFsdbysDWYnxFJeVAg-53" value="Stored each opcode<br>and arg in separate<br>list node" style="strokeWidth=2;html=1;shape=mxgraph.flowchart.annotation_2;align=center;labelPosition=center;pointerEvents=1;verticalAlign=bottom;fontFamily=Helvetica;fontSize=12;flipH=1;flipV=1;direction=south;horizontal=1;verticalLabelPosition=top;dashed=1;dashPattern=1 1;rounded=1;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
<mxGeometry x="404" y="360" width="100" height="50" as="geometry" />
</mxCell>
<mxCell id="0wCFsdbysDWYnxFJeVAg-59" value="Create an array of<br>instruction to hold&nbsp;<br>all predefined&nbsp;<br>opcodes and function<br>pointers, and for each<br>function pointer, create<br>a corresponding function." style="strokeWidth=2;html=1;shape=mxgraph.flowchart.annotation_2;align=left;labelPosition=right;pointerEvents=1;verticalAlign=middle;fontFamily=Helvetica;fontSize=12;flipH=1;flipV=1;direction=west;horizontal=1;verticalLabelPosition=middle;dashed=1;dashPattern=1 1;rounded=1;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
<mxGeometry x="610" y="390" width="67" height="100" as="geometry" />
</mxCell>
<mxCell id="0wCFsdbysDWYnxFJeVAg-68" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="0wCFsdbysDWYnxFJeVAg-61" target="0wCFsdbysDWYnxFJeVAg-65">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="0wCFsdbysDWYnxFJeVAg-69" value="Yes" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" vertex="1" connectable="0" parent="0wCFsdbysDWYnxFJeVAg-68">
<mxGeometry x="-0.2706" relative="1" as="geometry">
<mxPoint x="1" as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="0wCFsdbysDWYnxFJeVAg-75" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="0wCFsdbysDWYnxFJeVAg-61" target="0wCFsdbysDWYnxFJeVAg-74">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="0wCFsdbysDWYnxFJeVAg-76" value="No" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" vertex="1" connectable="0" parent="0wCFsdbysDWYnxFJeVAg-75">
<mxGeometry x="-0.2" y="1" relative="1" as="geometry">
<mxPoint y="1" as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="0wCFsdbysDWYnxFJeVAg-61" value="Opcode<br>match?" style="rhombus;whiteSpace=wrap;html=1;rounded=1;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
<mxGeometry x="542.5" y="307.5" width="65" height="70" as="geometry" />
</mxCell>
<mxCell id="0wCFsdbysDWYnxFJeVAg-79" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="0wCFsdbysDWYnxFJeVAg-65" target="0wCFsdbysDWYnxFJeVAg-77">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="0wCFsdbysDWYnxFJeVAg-65" value="Execute the function pointer and return result to stdout" style="shape=process;whiteSpace=wrap;html=1;backgroundOutline=1;rounded=1;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
<mxGeometry x="517.5" y="205" width="115" height="60" as="geometry" />
</mxCell>
<mxCell id="0wCFsdbysDWYnxFJeVAg-78" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="0wCFsdbysDWYnxFJeVAg-74" target="0wCFsdbysDWYnxFJeVAg-77">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="0wCFsdbysDWYnxFJeVAg-74" value="Print no opcode found error and exit failure" style="rounded=1;whiteSpace=wrap;html=1;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
<mxGeometry x="695" y="310.63" width="80" height="63.75" as="geometry" />
</mxCell>
<mxCell id="0wCFsdbysDWYnxFJeVAg-77" value="END" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#008a00;fontColor=#ffffff;strokeColor=#005700;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
<mxGeometry x="700" y="225" width="70" height="20" as="geometry" />
</mxCell>
<mxCell id="0wCFsdbysDWYnxFJeVAg-99" value="<h1><font face="Helvetica">FLOW CHART OF MONTY PROJECT</font></h1>" style="text;strokeColor=none;align=center;fillColor=none;html=1;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
<mxGeometry x="182.5" y="5" width="432" height="30" as="geometry" />
</mxCell>
<mxCell id="0wCFsdbysDWYnxFJeVAg-100" value="Monty 0.98 is a scripting language that is first compiled into Monty byte codes (Just like Python). It relies on a unique stack, with specific instructions to manipulate it. The goal of this project is to create an interpreter for Monty ByteCodes files. The implementation of this project can be found on this github repo:&nbsp;https://github.com/Usool-Data-Science/monty" style="text;strokeColor=none;align=left;fillColor=none;html=1;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
<mxGeometry x="189" y="40" width="659" height="42" as="geometry" />
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>