implemented assembly for addition, substraction and multiplication. Division is not working yet
This commit is contained in:
parent
66417bb16e
commit
120a575b15
5 changed files with 134 additions and 69 deletions
107
Compiler/.idea/.idea.Compiler/.idea/workspace.xml
generated
107
Compiler/.idea/.idea.Compiler/.idea/workspace.xml
generated
|
|
@ -21,7 +21,10 @@
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="a54bb6de-191c-4bd1-91ab-3953adfc5dfb" name="Default Changelist" comment="">
|
<list default="true" id="a54bb6de-191c-4bd1-91ab-3953adfc5dfb" name="Default Changelist" comment="">
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/.idea.Compiler/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.Compiler/.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/.idea.Compiler/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.Compiler/.idea/workspace.xml" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/Compiler.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Compiler.cs" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/DevFunctions.cs" beforeDir="false" afterPath="$PROJECT_DIR$/DevFunctions.cs" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/DevFunctions.cs" beforeDir="false" afterPath="$PROJECT_DIR$/DevFunctions.cs" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/Generator/Generator.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Generator/Generator.cs" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/Parser/Parser.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Parser/Parser.cs" afterDir="false" />
|
||||||
</list>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
|
|
@ -94,10 +97,8 @@
|
||||||
<option value="$PROJECT_DIR$/Parser/Nodes/ReturnNode.cs" />
|
<option value="$PROJECT_DIR$/Parser/Nodes/ReturnNode.cs" />
|
||||||
<option value="$PROJECT_DIR$/Parser/Nodes/OperatorTypes.cs" />
|
<option value="$PROJECT_DIR$/Parser/Nodes/OperatorTypes.cs" />
|
||||||
<option value="$PROJECT_DIR$/Parser/Nodes/UnaryOperatorNode.cs" />
|
<option value="$PROJECT_DIR$/Parser/Nodes/UnaryOperatorNode.cs" />
|
||||||
<option value="$PROJECT_DIR$/Compiler.cs" />
|
|
||||||
<option value="$PROJECT_DIR$/Generator/NotSpecifiedException.cs" />
|
<option value="$PROJECT_DIR$/Generator/NotSpecifiedException.cs" />
|
||||||
<option value="$PROJECT_DIR$/../test.s" />
|
<option value="$PROJECT_DIR$/../test.s" />
|
||||||
<option value="$PROJECT_DIR$/Generator/Generator.cs" />
|
|
||||||
<option value="$PROJECT_DIR$/Lexer/TokenType.cs" />
|
<option value="$PROJECT_DIR$/Lexer/TokenType.cs" />
|
||||||
<option value="$PROJECT_DIR$/Lexer/Lexer.cs" />
|
<option value="$PROJECT_DIR$/Lexer/Lexer.cs" />
|
||||||
<option value="$PROJECT_DIR$/Parser/Nodes/NodeType.cs" />
|
<option value="$PROJECT_DIR$/Parser/Nodes/NodeType.cs" />
|
||||||
|
|
@ -105,8 +106,10 @@
|
||||||
<option value="$PROJECT_DIR$/Parser/Nodes/OperatorType.cs" />
|
<option value="$PROJECT_DIR$/Parser/Nodes/OperatorType.cs" />
|
||||||
<option value="$PROJECT_DIR$/Parser/Nodes/ConstantNode.cs" />
|
<option value="$PROJECT_DIR$/Parser/Nodes/ConstantNode.cs" />
|
||||||
<option value="$PROJECT_DIR$/../grammar" />
|
<option value="$PROJECT_DIR$/../grammar" />
|
||||||
|
<option value="$PROJECT_DIR$/Compiler.cs" />
|
||||||
<option value="$PROJECT_DIR$/Parser/Parser.cs" />
|
<option value="$PROJECT_DIR$/Parser/Parser.cs" />
|
||||||
<option value="$PROJECT_DIR$/DevFunctions.cs" />
|
<option value="$PROJECT_DIR$/DevFunctions.cs" />
|
||||||
|
<option value="$PROJECT_DIR$/Generator/Generator.cs" />
|
||||||
</list>
|
</list>
|
||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
|
|
@ -121,8 +124,8 @@
|
||||||
<component name="PropertiesComponent">
|
<component name="PropertiesComponent">
|
||||||
<property name="ASKED_ADD_EXTERNAL_FILES" value="true" />
|
<property name="ASKED_ADD_EXTERNAL_FILES" value="true" />
|
||||||
<property name="ASKED_SHARE_PROJECT_CONFIGURATION_FILES" value="true" />
|
<property name="ASKED_SHARE_PROJECT_CONFIGURATION_FILES" value="true" />
|
||||||
<property name="DebuggerViewTab_PTCS_FirstProportionKey" value="0.5697674" />
|
<property name="DebuggerViewTab_PTCS_FirstProportionKey" value="0.5698324" />
|
||||||
<property name="DebuggerViewTab_PTCS_LastProportionKey" value="0.4883721" />
|
<property name="DebuggerViewTab_PTCS_LastProportionKey" value="0.48789573" />
|
||||||
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
|
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
|
||||||
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
|
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
|
||||||
<property name="SHARE_PROJECT_CONFIGURATION_FILES" value="true" />
|
<property name="SHARE_PROJECT_CONFIGURATION_FILES" value="true" />
|
||||||
|
|
@ -174,6 +177,7 @@
|
||||||
<workItem from="1598037838306" duration="329000" />
|
<workItem from="1598037838306" duration="329000" />
|
||||||
<workItem from="1598123734996" duration="12557000" />
|
<workItem from="1598123734996" duration="12557000" />
|
||||||
<workItem from="1598197309733" duration="2969000" />
|
<workItem from="1598197309733" duration="2969000" />
|
||||||
|
<workItem from="1598260697761" duration="4427000" />
|
||||||
</task>
|
</task>
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
|
|
@ -231,69 +235,85 @@
|
||||||
<screen x="1920" y="0" width="1920" height="1080" />
|
<screen x="1920" y="0" width="1920" height="1080" />
|
||||||
</state>
|
</state>
|
||||||
<state width="1868" height="383" key="GridCell.Tab.-1.right/1920.0.1920.1080/0.0.1920.1080@1920.0.1920.1080" timestamp="1597955238557" />
|
<state width="1868" height="383" key="GridCell.Tab.-1.right/1920.0.1920.1080/0.0.1920.1080@1920.0.1920.1080" timestamp="1597955238557" />
|
||||||
<state width="1292" height="330" key="GridCell.Tab.0.bottom" timestamp="1598200278840">
|
<state width="908" height="239" key="GridCell.Tab.0.bottom" timestamp="1598264325655">
|
||||||
<screen x="1920" y="0" width="1920" height="1080" />
|
<screen x="0" y="0" width="1920" height="1080" />
|
||||||
</state>
|
</state>
|
||||||
|
<state width="908" height="239" key="GridCell.Tab.0.bottom/0.0.1920.1080@0.0.1920.1080" timestamp="1598264325655" />
|
||||||
<state width="1292" height="330" key="GridCell.Tab.0.bottom/1920.0.1920.1080/0.0.1920.1080@1920.0.1920.1080" timestamp="1598200278840" />
|
<state width="1292" height="330" key="GridCell.Tab.0.bottom/1920.0.1920.1080/0.0.1920.1080@1920.0.1920.1080" timestamp="1598200278840" />
|
||||||
<state width="1292" height="330" key="GridCell.Tab.0.center" timestamp="1598200278840">
|
<state width="908" height="239" key="GridCell.Tab.0.center" timestamp="1598264325654">
|
||||||
<screen x="1920" y="0" width="1920" height="1080" />
|
<screen x="0" y="0" width="1920" height="1080" />
|
||||||
</state>
|
</state>
|
||||||
|
<state width="908" height="239" key="GridCell.Tab.0.center/0.0.1920.1080@0.0.1920.1080" timestamp="1598264325654" />
|
||||||
<state width="1292" height="330" key="GridCell.Tab.0.center/1920.0.1920.1080/0.0.1920.1080@1920.0.1920.1080" timestamp="1598200278840" />
|
<state width="1292" height="330" key="GridCell.Tab.0.center/1920.0.1920.1080/0.0.1920.1080@1920.0.1920.1080" timestamp="1598200278840" />
|
||||||
<state width="1292" height="330" key="GridCell.Tab.0.left" timestamp="1598200278840">
|
<state width="908" height="239" key="GridCell.Tab.0.left" timestamp="1598264325654">
|
||||||
<screen x="1920" y="0" width="1920" height="1080" />
|
<screen x="0" y="0" width="1920" height="1080" />
|
||||||
</state>
|
</state>
|
||||||
|
<state width="908" height="239" key="GridCell.Tab.0.left/0.0.1920.1080@0.0.1920.1080" timestamp="1598264325654" />
|
||||||
<state width="1292" height="330" key="GridCell.Tab.0.left/1920.0.1920.1080/0.0.1920.1080@1920.0.1920.1080" timestamp="1598200278840" />
|
<state width="1292" height="330" key="GridCell.Tab.0.left/1920.0.1920.1080/0.0.1920.1080@1920.0.1920.1080" timestamp="1598200278840" />
|
||||||
<state width="1292" height="330" key="GridCell.Tab.0.right" timestamp="1598200278840">
|
<state width="908" height="239" key="GridCell.Tab.0.right" timestamp="1598264325655">
|
||||||
<screen x="1920" y="0" width="1920" height="1080" />
|
<screen x="0" y="0" width="1920" height="1080" />
|
||||||
</state>
|
</state>
|
||||||
|
<state width="908" height="239" key="GridCell.Tab.0.right/0.0.1920.1080@0.0.1920.1080" timestamp="1598264325655" />
|
||||||
<state width="1292" height="330" key="GridCell.Tab.0.right/1920.0.1920.1080/0.0.1920.1080@1920.0.1920.1080" timestamp="1598200278840" />
|
<state width="1292" height="330" key="GridCell.Tab.0.right/1920.0.1920.1080/0.0.1920.1080@1920.0.1920.1080" timestamp="1598200278840" />
|
||||||
<state width="1292" height="330" key="GridCell.Tab.1.bottom" timestamp="1598200278840">
|
<state width="908" height="318" key="GridCell.Tab.1.bottom" timestamp="1598263677978">
|
||||||
<screen x="1920" y="0" width="1920" height="1080" />
|
<screen x="0" y="0" width="1920" height="1080" />
|
||||||
</state>
|
</state>
|
||||||
|
<state width="908" height="318" key="GridCell.Tab.1.bottom/0.0.1920.1080@0.0.1920.1080" timestamp="1598263677978" />
|
||||||
<state width="1292" height="330" key="GridCell.Tab.1.bottom/1920.0.1920.1080/0.0.1920.1080@1920.0.1920.1080" timestamp="1598200278840" />
|
<state width="1292" height="330" key="GridCell.Tab.1.bottom/1920.0.1920.1080/0.0.1920.1080@1920.0.1920.1080" timestamp="1598200278840" />
|
||||||
<state width="1292" height="330" key="GridCell.Tab.1.center" timestamp="1598200278840">
|
<state width="908" height="318" key="GridCell.Tab.1.center" timestamp="1598263677978">
|
||||||
<screen x="1920" y="0" width="1920" height="1080" />
|
<screen x="0" y="0" width="1920" height="1080" />
|
||||||
</state>
|
</state>
|
||||||
|
<state width="908" height="318" key="GridCell.Tab.1.center/0.0.1920.1080@0.0.1920.1080" timestamp="1598263677978" />
|
||||||
<state width="1292" height="330" key="GridCell.Tab.1.center/1920.0.1920.1080/0.0.1920.1080@1920.0.1920.1080" timestamp="1598200278840" />
|
<state width="1292" height="330" key="GridCell.Tab.1.center/1920.0.1920.1080/0.0.1920.1080@1920.0.1920.1080" timestamp="1598200278840" />
|
||||||
<state width="1292" height="330" key="GridCell.Tab.1.left" timestamp="1598200278840">
|
<state width="908" height="318" key="GridCell.Tab.1.left" timestamp="1598263677978">
|
||||||
<screen x="1920" y="0" width="1920" height="1080" />
|
<screen x="0" y="0" width="1920" height="1080" />
|
||||||
</state>
|
</state>
|
||||||
|
<state width="908" height="318" key="GridCell.Tab.1.left/0.0.1920.1080@0.0.1920.1080" timestamp="1598263677978" />
|
||||||
<state width="1292" height="330" key="GridCell.Tab.1.left/1920.0.1920.1080/0.0.1920.1080@1920.0.1920.1080" timestamp="1598200278840" />
|
<state width="1292" height="330" key="GridCell.Tab.1.left/1920.0.1920.1080/0.0.1920.1080@1920.0.1920.1080" timestamp="1598200278840" />
|
||||||
<state width="1292" height="330" key="GridCell.Tab.1.right" timestamp="1598200278840">
|
<state width="908" height="318" key="GridCell.Tab.1.right" timestamp="1598263677978">
|
||||||
<screen x="1920" y="0" width="1920" height="1080" />
|
<screen x="0" y="0" width="1920" height="1080" />
|
||||||
</state>
|
</state>
|
||||||
|
<state width="908" height="318" key="GridCell.Tab.1.right/0.0.1920.1080@0.0.1920.1080" timestamp="1598263677978" />
|
||||||
<state width="1292" height="330" key="GridCell.Tab.1.right/1920.0.1920.1080/0.0.1920.1080@1920.0.1920.1080" timestamp="1598200278840" />
|
<state width="1292" height="330" key="GridCell.Tab.1.right/1920.0.1920.1080/0.0.1920.1080@1920.0.1920.1080" timestamp="1598200278840" />
|
||||||
<state width="1292" height="330" key="GridCell.Tab.2.bottom" timestamp="1598200278840">
|
<state width="908" height="318" key="GridCell.Tab.2.bottom" timestamp="1598263677978">
|
||||||
<screen x="1920" y="0" width="1920" height="1080" />
|
<screen x="0" y="0" width="1920" height="1080" />
|
||||||
</state>
|
</state>
|
||||||
|
<state width="908" height="318" key="GridCell.Tab.2.bottom/0.0.1920.1080@0.0.1920.1080" timestamp="1598263677978" />
|
||||||
<state width="1292" height="330" key="GridCell.Tab.2.bottom/1920.0.1920.1080/0.0.1920.1080@1920.0.1920.1080" timestamp="1598200278840" />
|
<state width="1292" height="330" key="GridCell.Tab.2.bottom/1920.0.1920.1080/0.0.1920.1080@1920.0.1920.1080" timestamp="1598200278840" />
|
||||||
<state width="1292" height="330" key="GridCell.Tab.2.center" timestamp="1598200278840">
|
<state width="908" height="318" key="GridCell.Tab.2.center" timestamp="1598263677978">
|
||||||
<screen x="1920" y="0" width="1920" height="1080" />
|
<screen x="0" y="0" width="1920" height="1080" />
|
||||||
</state>
|
</state>
|
||||||
|
<state width="908" height="318" key="GridCell.Tab.2.center/0.0.1920.1080@0.0.1920.1080" timestamp="1598263677978" />
|
||||||
<state width="1292" height="330" key="GridCell.Tab.2.center/1920.0.1920.1080/0.0.1920.1080@1920.0.1920.1080" timestamp="1598200278840" />
|
<state width="1292" height="330" key="GridCell.Tab.2.center/1920.0.1920.1080/0.0.1920.1080@1920.0.1920.1080" timestamp="1598200278840" />
|
||||||
<state width="1292" height="330" key="GridCell.Tab.2.left" timestamp="1598200278840">
|
<state width="908" height="318" key="GridCell.Tab.2.left" timestamp="1598263677978">
|
||||||
<screen x="1920" y="0" width="1920" height="1080" />
|
<screen x="0" y="0" width="1920" height="1080" />
|
||||||
</state>
|
</state>
|
||||||
|
<state width="908" height="318" key="GridCell.Tab.2.left/0.0.1920.1080@0.0.1920.1080" timestamp="1598263677978" />
|
||||||
<state width="1292" height="330" key="GridCell.Tab.2.left/1920.0.1920.1080/0.0.1920.1080@1920.0.1920.1080" timestamp="1598200278840" />
|
<state width="1292" height="330" key="GridCell.Tab.2.left/1920.0.1920.1080/0.0.1920.1080@1920.0.1920.1080" timestamp="1598200278840" />
|
||||||
<state width="1292" height="330" key="GridCell.Tab.2.right" timestamp="1598200278840">
|
<state width="908" height="318" key="GridCell.Tab.2.right" timestamp="1598263677978">
|
||||||
<screen x="1920" y="0" width="1920" height="1080" />
|
<screen x="0" y="0" width="1920" height="1080" />
|
||||||
</state>
|
</state>
|
||||||
|
<state width="908" height="318" key="GridCell.Tab.2.right/0.0.1920.1080@0.0.1920.1080" timestamp="1598263677978" />
|
||||||
<state width="1292" height="330" key="GridCell.Tab.2.right/1920.0.1920.1080/0.0.1920.1080@1920.0.1920.1080" timestamp="1598200278840" />
|
<state width="1292" height="330" key="GridCell.Tab.2.right/1920.0.1920.1080/0.0.1920.1080@1920.0.1920.1080" timestamp="1598200278840" />
|
||||||
<state width="1292" height="330" key="GridCell.Tab.3.bottom" timestamp="1598200278840">
|
<state width="908" height="318" key="GridCell.Tab.3.bottom" timestamp="1598263677979">
|
||||||
<screen x="1920" y="0" width="1920" height="1080" />
|
<screen x="0" y="0" width="1920" height="1080" />
|
||||||
</state>
|
</state>
|
||||||
|
<state width="908" height="318" key="GridCell.Tab.3.bottom/0.0.1920.1080@0.0.1920.1080" timestamp="1598263677979" />
|
||||||
<state width="1292" height="330" key="GridCell.Tab.3.bottom/1920.0.1920.1080/0.0.1920.1080@1920.0.1920.1080" timestamp="1598200278840" />
|
<state width="1292" height="330" key="GridCell.Tab.3.bottom/1920.0.1920.1080/0.0.1920.1080@1920.0.1920.1080" timestamp="1598200278840" />
|
||||||
<state width="1292" height="330" key="GridCell.Tab.3.center" timestamp="1598200278840">
|
<state width="908" height="318" key="GridCell.Tab.3.center" timestamp="1598263677979">
|
||||||
<screen x="1920" y="0" width="1920" height="1080" />
|
<screen x="0" y="0" width="1920" height="1080" />
|
||||||
</state>
|
</state>
|
||||||
|
<state width="908" height="318" key="GridCell.Tab.3.center/0.0.1920.1080@0.0.1920.1080" timestamp="1598263677979" />
|
||||||
<state width="1292" height="330" key="GridCell.Tab.3.center/1920.0.1920.1080/0.0.1920.1080@1920.0.1920.1080" timestamp="1598200278840" />
|
<state width="1292" height="330" key="GridCell.Tab.3.center/1920.0.1920.1080/0.0.1920.1080@1920.0.1920.1080" timestamp="1598200278840" />
|
||||||
<state width="1292" height="330" key="GridCell.Tab.3.left" timestamp="1598200278840">
|
<state width="908" height="318" key="GridCell.Tab.3.left" timestamp="1598263677979">
|
||||||
<screen x="1920" y="0" width="1920" height="1080" />
|
<screen x="0" y="0" width="1920" height="1080" />
|
||||||
</state>
|
</state>
|
||||||
|
<state width="908" height="318" key="GridCell.Tab.3.left/0.0.1920.1080@0.0.1920.1080" timestamp="1598263677979" />
|
||||||
<state width="1292" height="330" key="GridCell.Tab.3.left/1920.0.1920.1080/0.0.1920.1080@1920.0.1920.1080" timestamp="1598200278840" />
|
<state width="1292" height="330" key="GridCell.Tab.3.left/1920.0.1920.1080/0.0.1920.1080@1920.0.1920.1080" timestamp="1598200278840" />
|
||||||
<state width="1292" height="330" key="GridCell.Tab.3.right" timestamp="1598200278840">
|
<state width="908" height="318" key="GridCell.Tab.3.right" timestamp="1598263677979">
|
||||||
<screen x="1920" y="0" width="1920" height="1080" />
|
<screen x="0" y="0" width="1920" height="1080" />
|
||||||
</state>
|
</state>
|
||||||
|
<state width="908" height="318" key="GridCell.Tab.3.right/0.0.1920.1080@0.0.1920.1080" timestamp="1598263677979" />
|
||||||
<state width="1292" height="330" key="GridCell.Tab.3.right/1920.0.1920.1080/0.0.1920.1080@1920.0.1920.1080" timestamp="1598200278840" />
|
<state width="1292" height="330" key="GridCell.Tab.3.right/1920.0.1920.1080/0.0.1920.1080@1920.0.1920.1080" timestamp="1598200278840" />
|
||||||
<state width="1868" height="383" key="GridCell.Tab.4.bottom" timestamp="1597955234640">
|
<state width="1868" height="383" key="GridCell.Tab.4.bottom" timestamp="1597955234640">
|
||||||
<screen x="1920" y="0" width="1920" height="1080" />
|
<screen x="1920" y="0" width="1920" height="1080" />
|
||||||
|
|
@ -347,9 +367,10 @@
|
||||||
<screen x="0" y="0" width="1920" height="1080" />
|
<screen x="0" y="0" width="1920" height="1080" />
|
||||||
</state>
|
</state>
|
||||||
<state x="0" y="557" width="1920" height="523" key="dock-window-3/1920.0.1920.1080/0.0.1920.1080@1920.0.1920.1080" timestamp="1597934748776" />
|
<state x="0" y="557" width="1920" height="523" key="dock-window-3/1920.0.1920.1080/0.0.1920.1080@1920.0.1920.1080" timestamp="1597934748776" />
|
||||||
<state x="2543" y="239" width="672" height="678" key="search.everywhere.popup" timestamp="1597698616567">
|
<state x="623" y="239" width="672" height="678" key="search.everywhere.popup" timestamp="1598261278301">
|
||||||
<screen x="1920" y="0" width="1920" height="1080" />
|
<screen x="0" y="0" width="1920" height="1080" />
|
||||||
</state>
|
</state>
|
||||||
|
<state x="623" y="239" width="672" height="678" key="search.everywhere.popup/0.0.1920.1080@0.0.1920.1080" timestamp="1598261278301" />
|
||||||
<state x="2543" y="239" width="672" height="678" key="search.everywhere.popup/1920.0.1920.1080/0.0.1920.1080@1920.0.1920.1080" timestamp="1597698616567" />
|
<state x="2543" y="239" width="672" height="678" key="search.everywhere.popup/1920.0.1920.1080/0.0.1920.1080@1920.0.1920.1080" timestamp="1597698616567" />
|
||||||
</component>
|
</component>
|
||||||
<component name="XDebuggerManager">
|
<component name="XDebuggerManager">
|
||||||
|
|
@ -357,16 +378,16 @@
|
||||||
<breakpoints>
|
<breakpoints>
|
||||||
<line-breakpoint enabled="true" type="DotNet Breakpoints">
|
<line-breakpoint enabled="true" type="DotNet Breakpoints">
|
||||||
<url>file://$PROJECT_DIR$/Parser/Parser.cs</url>
|
<url>file://$PROJECT_DIR$/Parser/Parser.cs</url>
|
||||||
<line>261</line>
|
<line>262</line>
|
||||||
<properties documentPath="$PROJECT_DIR$/Parser/Parser.cs" initialLine="227">
|
<properties documentPath="$PROJECT_DIR$/Parser/Parser.cs" initialLine="261">
|
||||||
<startOffsets>
|
<startOffsets>
|
||||||
<option value="10821" />
|
<option value="10930" />
|
||||||
</startOffsets>
|
</startOffsets>
|
||||||
<endOffsets>
|
<endOffsets>
|
||||||
<option value="10847" />
|
<option value="10956" />
|
||||||
</endOffsets>
|
</endOffsets>
|
||||||
</properties>
|
</properties>
|
||||||
<option name="timeStamp" value="13" />
|
<option name="timeStamp" value="14" />
|
||||||
</line-breakpoint>
|
</line-breakpoint>
|
||||||
</breakpoints>
|
</breakpoints>
|
||||||
</breakpoint-manager>
|
</breakpoint-manager>
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ namespace Compiler
|
||||||
|
|
||||||
if (args.Length == 2)
|
if (args.Length == 2)
|
||||||
{
|
{
|
||||||
if (args[2] == "-v")
|
if (args[1] == "-v")
|
||||||
{
|
{
|
||||||
debug = true;
|
debug = true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -104,18 +104,23 @@ namespace Compiler
|
||||||
|
|
||||||
public static void DevMode()
|
public static void DevMode()
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
for (int i = 3; i <= 3; i++)
|
for (int i = 3; i <= 3; i++)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"---------------------valid, stage {i}-------------------------------");
|
Console.WriteLine($"---------------------valid, stage {i}-------------------------------");
|
||||||
foreach (string file in Directory.GetFiles($"/home/clemens/repositorys/lcc/stage_{i}/valid"))
|
foreach (string file in Directory.GetFiles($"/home/clemens/repositorys/lcc/stage_{i}/valid"))
|
||||||
{
|
{
|
||||||
|
*/
|
||||||
|
|
||||||
|
string file = "/home/clemens/repositorys/lcc/stage_3/valid/sub.c";
|
||||||
|
|
||||||
Console.WriteLine("-------------");
|
Console.WriteLine("-------------");
|
||||||
List<Token> tokens = TestLexer(file, 0);
|
List<Token> tokens = TestLexer(file, 0);
|
||||||
Node programNode = TestParser(tokens, file, 1);
|
Node programNode = TestParser(tokens, file, 1);
|
||||||
//TestGenerator(programNode, 1);
|
TestGenerator(programNode, 1);
|
||||||
}
|
//}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
Console.WriteLine($"---------------------invalid, stage {i}-------------------------------");
|
Console.WriteLine($"---------------------invalid, stage {i}-------------------------------");
|
||||||
foreach (string file in Directory.GetFiles($"/home/clemens/repositorys/lcc/stage_{i}/invalid"))
|
foreach (string file in Directory.GetFiles($"/home/clemens/repositorys/lcc/stage_{i}/invalid"))
|
||||||
{
|
{
|
||||||
|
|
@ -124,8 +129,8 @@ namespace Compiler
|
||||||
Node programNode = TestParser(tokens, file, 1);
|
Node programNode = TestParser(tokens, file, 1);
|
||||||
//TestGenerator(programNode, 1);
|
//TestGenerator(programNode, 1);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -63,6 +63,44 @@ namespace Compiler.Generator
|
||||||
((UnaryOperatorNode) rootNode).OperatorType);
|
((UnaryOperatorNode) rootNode).OperatorType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
case NodeType.BinaryOperatorNode:
|
||||||
|
switch (((BinaryOperatorNode) rootNode).OperatorType)
|
||||||
|
{
|
||||||
|
case OperatorType.Addition:
|
||||||
|
s = $"{Generate(rootNode.Children[0])}" +
|
||||||
|
"push %rax\n" +
|
||||||
|
$"{Generate(rootNode.Children[1])}" +
|
||||||
|
"pop %rcx\n" +
|
||||||
|
"add %ecx, %eax\n";
|
||||||
|
break;
|
||||||
|
case OperatorType.Subtraction:
|
||||||
|
s = $"{Generate(rootNode.Children[1])}" +
|
||||||
|
"push %rax\n" +
|
||||||
|
$"{Generate(rootNode.Children[0])}" +
|
||||||
|
"pop %rcx\n" +
|
||||||
|
"sub %ecx, %eax\n";
|
||||||
|
break;
|
||||||
|
case OperatorType.Multiplication:
|
||||||
|
s = $"{Generate(rootNode.Children[0])}" +
|
||||||
|
"push %rax\n" +
|
||||||
|
$"{Generate(rootNode.Children[1])}" +
|
||||||
|
"pop %rcx\n" +
|
||||||
|
"imul %rcx, %rax\n";
|
||||||
|
break;
|
||||||
|
case OperatorType.Division:
|
||||||
|
s = $"{Generate(rootNode.Children[0])}" +
|
||||||
|
"push %rax\n" +
|
||||||
|
$"{Generate(rootNode.Children[1])}" +
|
||||||
|
"movl %eax, %ecx" + //move calculated divisor to %ecx
|
||||||
|
"pop %rbx\n" + //pop divident do %ebx
|
||||||
|
"cdq\n" +
|
||||||
|
"idivl %ecx\n";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new ArgumentOutOfRangeException();
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new NotSpecifiedException(rootNode.NodeType);
|
throw new NotSpecifiedException(rootNode.NodeType);
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ namespace Compiler.Parser
|
||||||
}
|
}
|
||||||
|
|
||||||
//The main RDP function
|
//The main RDP function
|
||||||
public Node Parse(NodeType nodeType)
|
public Node Parse(NodeType nodeType, bool unopPrecedence = false)
|
||||||
{
|
{
|
||||||
//declare node to be returned
|
//declare node to be returned
|
||||||
Node n;
|
Node n;
|
||||||
|
|
@ -125,8 +125,9 @@ namespace Compiler.Parser
|
||||||
|
|
||||||
//if the next token is a + or a - it must be a binary operator because we are in an expression
|
//if the next token is a + or a - it must be a binary operator because we are in an expression
|
||||||
//that means that this is not a plain constant but a BinaryOperator node
|
//that means that this is not a plain constant but a BinaryOperator node
|
||||||
while (expressionToken.TokenType == TokenType.AdditionToken ||
|
//also check if the last token was a unary operator
|
||||||
expressionToken.TokenType == TokenType.NegationToken)
|
while ((expressionToken.TokenType == TokenType.AdditionToken ||
|
||||||
|
expressionToken.TokenType == TokenType.NegationToken) && !unopPrecedence)
|
||||||
{
|
{
|
||||||
//remove the - or + token
|
//remove the - or + token
|
||||||
_tokenList.RemoveAt(0);
|
_tokenList.RemoveAt(0);
|
||||||
|
|
@ -181,8 +182,8 @@ namespace Compiler.Parser
|
||||||
Token termToken = _tokenList[0];
|
Token termToken = _tokenList[0];
|
||||||
|
|
||||||
//parse second factor if it exists
|
//parse second factor if it exists
|
||||||
while (termToken.TokenType == TokenType.MultiplicationToken ||
|
while ((termToken.TokenType == TokenType.MultiplicationToken ||
|
||||||
termToken.TokenType == TokenType.DivisionToken)
|
termToken.TokenType == TokenType.DivisionToken) && !unopPrecedence)
|
||||||
{
|
{
|
||||||
_tokenList.RemoveAt(0);
|
_tokenList.RemoveAt(0);
|
||||||
switch (termToken.TokenType)
|
switch (termToken.TokenType)
|
||||||
|
|
@ -274,15 +275,15 @@ namespace Compiler.Parser
|
||||||
{
|
{
|
||||||
case TokenType.BitwiseComplementToken:
|
case TokenType.BitwiseComplementToken:
|
||||||
n = new UnaryOperatorNode(OperatorType.BitwiseComplement);
|
n = new UnaryOperatorNode(OperatorType.BitwiseComplement);
|
||||||
n.Children.Add(Parse(NodeType.ExpressionNode));
|
n.Children.Add(Parse(NodeType.ExpressionNode, unopPrecedence = true));
|
||||||
break;
|
break;
|
||||||
case TokenType.NegationToken:
|
case TokenType.NegationToken:
|
||||||
n = new UnaryOperatorNode(OperatorType.Negation);
|
n = new UnaryOperatorNode(OperatorType.Negation);
|
||||||
n.Children.Add(Parse(NodeType.ExpressionNode));
|
n.Children.Add(Parse(NodeType.ExpressionNode, unopPrecedence = true));
|
||||||
break;
|
break;
|
||||||
case TokenType.LogicalNegationToken:
|
case TokenType.LogicalNegationToken:
|
||||||
n = new UnaryOperatorNode(OperatorType.LogicalNegation);
|
n = new UnaryOperatorNode(OperatorType.LogicalNegation);
|
||||||
n.Children.Add(Parse(NodeType.ExpressionNode));
|
n.Children.Add(Parse(NodeType.ExpressionNode, unopPrecedence = true));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new UnexpectedTokenException(TokenType.IntegerLiteralToken,
|
throw new UnexpectedTokenException(TokenType.IntegerLiteralToken,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue