Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
DrEden33773 committed Dec 27, 2023
1 parent 721ea4b commit 3a6029b
Show file tree
Hide file tree
Showing 4 changed files with 156 additions and 1 deletion.
17 changes: 17 additions & 0 deletions examples/snap/multi_arg.pas
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
program A;

procedure A1;
var x;
begin
write(x)
end;

procedure A2;
begin
write(x)
end

begin
call A1();
call A2()
end
2 changes: 1 addition & 1 deletion src/translator/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ impl Translator {
//
// right now, after `load params`, self.addr (same as data_stack.top)
// must be the beginning pos/index of "current procedure's data slice"
// `add` "3 + proc.{args & var}.count +"
// + "3 + proc.{args & var}.count"
//
// so, INT self.addr will move `data_stack.top` to new area of curr proc's
// data slice
Expand Down
134 changes: 134 additions & 0 deletions structure.drawio
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
<mxfile host="65bd71144e">
<diagram id="IX9gLXWn7A2tthiQK04f" name="Page-1">
<mxGraphModel dx="650" dy="454" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="0">
<root>
<mxCell id="0"/>
<mxCell id="1" parent="0"/>
<mxCell id="2" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=-0.021;entryDx=0;entryDy=0;entryPerimeter=0;" edge="1" parent="1" source="6" target="15">
<mxGeometry relative="1" as="geometry">
<mxPoint x="414" y="340" as="targetPoint"/>
</mxGeometry>
</mxCell>
<mxCell id="3" value="AST" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" vertex="1" connectable="0" parent="2">
<mxGeometry x="-0.0327" y="-1" relative="1" as="geometry">
<mxPoint as="offset"/>
</mxGeometry>
</mxCell>
<mxCell id="4" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.75;exitY=1;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="6" target="23">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="5" value="语法错误" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" vertex="1" connectable="0" parent="4">
<mxGeometry x="0.2014" y="-2" relative="1" as="geometry">
<mxPoint x="2" y="-2" as="offset"/>
</mxGeometry>
</mxCell>
<mxCell id="6" value="语法分析器" style="swimlane;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="339" y="150" width="150" height="105" as="geometry"/>
</mxCell>
<mxCell id="7" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.25;exitY=1;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="6" source="9" target="6">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="45" y="130"/>
<mxPoint x="-29" y="130"/>
<mxPoint x="-29" y="52"/>
</Array>
</mxGeometry>
</mxCell>
<mxCell id="33" value="Token" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" vertex="1" connectable="0" parent="7">
<mxGeometry x="-0.1615" y="1" relative="1" as="geometry">
<mxPoint x="3" as="offset"/>
</mxGeometry>
</mxCell>
<mxCell id="9" value="词法分析器" style="whiteSpace=wrap;html=1;" vertex="1" parent="6">
<mxGeometry x="15" y="40" width="120" height="40" as="geometry"/>
</mxCell>
<mxCell id="10" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;" edge="1" parent="1" source="15" target="14">
<mxGeometry relative="1" as="geometry">
<mxPoint x="414" y="460" as="sourcePoint"/>
</mxGeometry>
</mxCell>
<mxCell id="11" value="IIterable&amp;lt;PCode&amp;gt;" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" vertex="1" connectable="0" parent="10">
<mxGeometry x="-0.1" y="1" relative="1" as="geometry">
<mxPoint as="offset"/>
</mxGeometry>
</mxCell>
<mxCell id="12" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="14" target="17">
<mxGeometry relative="1" as="geometry">
<mxPoint x="414" y="580" as="targetPoint"/>
</mxGeometry>
</mxCell>
<mxCell id="13" value="执行结果" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" vertex="1" connectable="0" parent="12">
<mxGeometry x="-0.1833" y="1" relative="1" as="geometry">
<mxPoint as="offset"/>
</mxGeometry>
</mxCell>
<mxCell id="14" value="解释执行器" style="whiteSpace=wrap;html=1;fontStyle=1;startSize=23;" vertex="1" parent="1">
<mxGeometry x="354" y="455" width="120" height="60" as="geometry"/>
</mxCell>
<mxCell id="15" value="代码生成器" style="swimlane;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="340" y="310" width="150" height="95" as="geometry"/>
</mxCell>
<mxCell id="16" value="语义分析器" style="whiteSpace=wrap;html=1;" vertex="1" parent="15">
<mxGeometry x="14" y="40" width="120" height="40" as="geometry"/>
</mxCell>
<mxCell id="17" value="输出" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;" vertex="1" parent="1">
<mxGeometry x="386.5" y="565" width="55" height="55" as="geometry"/>
</mxCell>
<mxCell id="18" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;" edge="1" parent="1" source="19" target="6">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="19" value="源程序" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;" vertex="1" parent="1">
<mxGeometry x="386" y="60" width="55" height="55" as="geometry"/>
</mxCell>
<mxCell id="20" value="错误管理 &amp;amp; 错误同步" style="swimlane;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="560" y="145" width="170" height="290" as="geometry"/>
</mxCell>
<mxCell id="21" value="词法错误&lt;br&gt;同步策略" style="rounded=1;whiteSpace=wrap;html=1;" vertex="1" parent="20">
<mxGeometry x="25" y="35" width="120" height="60" as="geometry"/>
</mxCell>
<mxCell id="22" value="语义分析错误&lt;br&gt;同步策略" style="rounded=1;whiteSpace=wrap;html=1;" vertex="1" parent="20">
<mxGeometry x="25" y="195" width="120" height="60" as="geometry"/>
</mxCell>
<mxCell id="23" value="语法错误&lt;br&gt;同步策略" style="rounded=1;whiteSpace=wrap;html=1;" vertex="1" parent="20">
<mxGeometry x="25" y="115" width="120" height="60" as="geometry"/>
</mxCell>
<mxCell id="24" value="" style="endArrow=classic;html=1;rounded=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="16" target="22">
<mxGeometry relative="1" as="geometry">
<mxPoint x="160" y="95" as="sourcePoint"/>
<mxPoint x="574" y="370" as="targetPoint"/>
</mxGeometry>
</mxCell>
<mxCell id="25" value="语义错误" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" vertex="1" connectable="0" parent="24">
<mxGeometry x="-0.0126" y="1" relative="1" as="geometry">
<mxPoint x="-9" y="1" as="offset"/>
</mxGeometry>
</mxCell>
<mxCell id="26" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="9" target="21">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="27" value="词法错误" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" vertex="1" connectable="0" parent="26">
<mxGeometry x="-0.2844" y="1" relative="1" as="geometry">
<mxPoint x="6" y="1" as="offset"/>
</mxGeometry>
</mxCell>
<mxCell id="28" value="符号表" style="swimlane;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="120" y="310" width="150" height="95" as="geometry"/>
</mxCell>
<mxCell id="29" value="CRUD操作" style="whiteSpace=wrap;html=1;" vertex="1" parent="28">
<mxGeometry x="15" y="40" width="120" height="40" as="geometry"/>
</mxCell>
<mxCell id="30" value="" style="endArrow=classic;startArrow=classic;html=1;rounded=0;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="29" target="16">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="370" y="405" as="sourcePoint"/>
<mxPoint x="420" y="355" as="targetPoint"/>
</mxGeometry>
</mxCell>
<mxCell id="31" value="符号检索" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" vertex="1" connectable="0" parent="30">
<mxGeometry x="-0.1255" y="-1" relative="1" as="geometry">
<mxPoint x="2" y="-1" as="offset"/>
</mxGeometry>
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>
Loading

0 comments on commit 3a6029b

Please sign in to comment.