broken shitty code
This commit is contained in:
parent
e6b20b5aa9
commit
5ec5c64775
28 changed files with 322 additions and 72 deletions
|
|
@ -27,6 +27,7 @@
|
|||
<e p="WrongTypeException.cs" t="Include" />
|
||||
</e>
|
||||
<e p="Nodes" t="Include">
|
||||
<e p="BinaryOperatorNode.cs" t="Include" />
|
||||
<e p="ConstantNode.cs" t="Include" />
|
||||
<e p="FunctionNode.cs" t="Include" />
|
||||
<e p="Node.cs" t="Include" />
|
||||
|
|
|
|||
166
Compiler/.idea/.idea.Compiler/.idea/workspace.xml
generated
166
Compiler/.idea/.idea.Compiler/.idea/workspace.xml
generated
|
|
@ -20,13 +20,34 @@
|
|||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="a54bb6de-191c-4bd1-91ab-3953adfc5dfb" name="Default Changelist" comment="">
|
||||
<change afterPath="$PROJECT_DIR$/DevFunctions.cs" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/Generator/NotSpecifiedException.cs" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/../test" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/Parser/Nodes/BinaryOperatorNode.cs" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/../stage_3/invalid/malformed_paren.c" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/../stage_3/invalid/missing_first_op.c" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/../stage_3/invalid/missing_second_op.c" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/../stage_3/invalid/no_semicolon.c" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/../stage_3/valid/add.c" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/../stage_3/valid/associativity.c" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/../stage_3/valid/associativity_2.c" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/../stage_3/valid/div.c" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/../stage_3/valid/div_neg.c" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/../stage_3/valid/mult.c" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/../stage_3/valid/parens.c" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/../stage_3/valid/precedence.c" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/../stage_3/valid/sub.c" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/../stage_3/valid/sub_neg.c" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/../stage_3/valid/unop_add.c" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/../stage_3/valid/unop_parens.c" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/.idea.Compiler/.idea/contentModel.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.Compiler/.idea/contentModel.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$/Generator/Generator.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Generator/Generator.cs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/DevFunctions.cs" beforeDir="false" afterPath="$PROJECT_DIR$/DevFunctions.cs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Lexer/Lexer.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Lexer/Lexer.cs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Lexer/TokenType.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Lexer/TokenType.cs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Parser/Nodes/ConstantNode.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Parser/Nodes/ConstantNode.cs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Parser/Nodes/NodeType.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Parser/Nodes/NodeType.cs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Parser/Nodes/OperatorType.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Parser/Nodes/OperatorType.cs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Parser/Parser.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Parser/Parser.cs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../grammar" beforeDir="false" afterPath="$PROJECT_DIR$/../grammar" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../test" beforeDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
|
@ -46,6 +67,8 @@
|
|||
<component name="HighlightingSettingsPerFile">
|
||||
<setting file="file://$PROJECT_DIR$/Compiler.cs" root0="FORCE_HIGHLIGHTING" />
|
||||
<setting file="file://$APPLICATION_CONFIG_DIR$/resharper-host/DecompilerCache/decompiler/714153FB-3DE5-4537-8A59-8AE8F7F7655E/44/126d3750/String.cs" root0="SKIP_HIGHLIGHTING" />
|
||||
<setting file="mock:///Dummy.cs" root0="SKIP_HIGHLIGHTING" />
|
||||
<setting file="mock:///Dummy.cs" root0="SKIP_HIGHLIGHTING" />
|
||||
<setting file="file://$PROJECT_DIR$/Lexer/Lexer.cs" root0="FORCE_HIGHLIGHTING" />
|
||||
<setting file="file://$PROJECT_DIR$/Lexer/Token.cs" root0="FORCE_HIGHLIGHTING" />
|
||||
<setting file="file://$APPLICATION_CONFIG_DIR$/resharper-host/DecompilerCache/decompiler/EEDBFCB1-C56E-4F7A-8B60-B8DD27E0DC7D/86/71102cca/Enumerable.cs" root0="SKIP_HIGHLIGHTING" />
|
||||
|
|
@ -96,20 +119,21 @@
|
|||
<option value="$PROJECT_DIR$/Parser/Exceptions/UnexpectedTokenException.cs" />
|
||||
<option value="$PROJECT_DIR$/t.tt" />
|
||||
<option value="$PROJECT_DIR$/Parser/Nodes/ReturnNode.cs" />
|
||||
<option value="$PROJECT_DIR$/Lexer/TokenType.cs" />
|
||||
<option value="$PROJECT_DIR$/Lexer/Lexer.cs" />
|
||||
<option value="$PROJECT_DIR$/../grammar" />
|
||||
<option value="$PROJECT_DIR$/Parser/Nodes/OperatorTypes.cs" />
|
||||
<option value="$PROJECT_DIR$/Parser/Nodes/OperatorType.cs" />
|
||||
<option value="$PROJECT_DIR$/Parser/Nodes/NodeType.cs" />
|
||||
<option value="$PROJECT_DIR$/Parser/Nodes/UnaryOperatorNode.cs" />
|
||||
<option value="$PROJECT_DIR$/Parser/Nodes/ConstantNode.cs" />
|
||||
<option value="$PROJECT_DIR$/Parser/Parser.cs" />
|
||||
<option value="$PROJECT_DIR$/Compiler.cs" />
|
||||
<option value="$PROJECT_DIR$/Generator/NotSpecifiedException.cs" />
|
||||
<option value="$PROJECT_DIR$/../test.s" />
|
||||
<option value="$PROJECT_DIR$/DevFunctions.cs" />
|
||||
<option value="$PROJECT_DIR$/Generator/Generator.cs" />
|
||||
<option value="$PROJECT_DIR$/Lexer/TokenType.cs" />
|
||||
<option value="$PROJECT_DIR$/Lexer/Lexer.cs" />
|
||||
<option value="$PROJECT_DIR$/Parser/Nodes/NodeType.cs" />
|
||||
<option value="$PROJECT_DIR$/Parser/Nodes/BinaryOperatorNode.cs" />
|
||||
<option value="$PROJECT_DIR$/Parser/Nodes/OperatorType.cs" />
|
||||
<option value="$PROJECT_DIR$/../grammar" />
|
||||
<option value="$PROJECT_DIR$/DevFunctions.cs" />
|
||||
<option value="$PROJECT_DIR$/Parser/Nodes/ConstantNode.cs" />
|
||||
<option value="$PROJECT_DIR$/Parser/Parser.cs" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
|
|
@ -124,13 +148,13 @@
|
|||
<component name="PropertiesComponent">
|
||||
<property name="ASKED_ADD_EXTERNAL_FILES" value="true" />
|
||||
<property name="ASKED_SHARE_PROJECT_CONFIGURATION_FILES" value="true" />
|
||||
<property name="DebuggerViewTab_PTCS_FirstProportionKey" value="0.56953055" />
|
||||
<property name="DebuggerViewTab_PTCS_LastProportionKey" value="0.4880425" />
|
||||
<property name="DebuggerViewTab_PTCS_FirstProportionKey" value="0.5697674" />
|
||||
<property name="DebuggerViewTab_PTCS_LastProportionKey" value="0.4883721" />
|
||||
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
|
||||
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
|
||||
<property name="SHARE_PROJECT_CONFIGURATION_FILES" value="true" />
|
||||
<property name="WebServerToolWindowFactoryState" value="false" />
|
||||
<property name="XThreadsFramesViewSplitterKey" value="0.2616179" />
|
||||
<property name="XThreadsFramesViewSplitterKey" value="0.44757032" />
|
||||
<property name="last_opened_file_path" value="$PROJECT_DIR$/.." />
|
||||
<property name="settings.editor.selected.configurable" value="preferences.pluginManager" />
|
||||
</component>
|
||||
|
|
@ -173,7 +197,9 @@
|
|||
<workItem from="1597695400525" duration="4873000" />
|
||||
<workItem from="1597863017034" duration="9651000" />
|
||||
<workItem from="1597932102881" duration="4296000" />
|
||||
<workItem from="1597952695048" duration="9189000" />
|
||||
<workItem from="1597952695048" duration="9233000" />
|
||||
<workItem from="1598037838306" duration="329000" />
|
||||
<workItem from="1598123734996" duration="12557000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
|
|
@ -231,70 +257,70 @@
|
|||
<screen x="1920" y="0" width="1920" height="1080" />
|
||||
</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="908" height="298" key="GridCell.Tab.0.bottom" timestamp="1597956915348">
|
||||
<state width="1292" height="330" key="GridCell.Tab.0.bottom" timestamp="1598136287234">
|
||||
<screen x="1920" y="0" width="1920" height="1080" />
|
||||
</state>
|
||||
<state width="908" height="298" key="GridCell.Tab.0.bottom/1920.0.1920.1080/0.0.1920.1080@1920.0.1920.1080" timestamp="1597956915348" />
|
||||
<state width="908" height="298" key="GridCell.Tab.0.center" timestamp="1597956915348">
|
||||
<state width="1292" height="330" key="GridCell.Tab.0.bottom/1920.0.1920.1080/0.0.1920.1080@1920.0.1920.1080" timestamp="1598136287234" />
|
||||
<state width="1292" height="330" key="GridCell.Tab.0.center" timestamp="1598136287234">
|
||||
<screen x="1920" y="0" width="1920" height="1080" />
|
||||
</state>
|
||||
<state width="908" height="298" key="GridCell.Tab.0.center/1920.0.1920.1080/0.0.1920.1080@1920.0.1920.1080" timestamp="1597956915348" />
|
||||
<state width="908" height="298" key="GridCell.Tab.0.left" timestamp="1597956915348">
|
||||
<state width="1292" height="330" key="GridCell.Tab.0.center/1920.0.1920.1080/0.0.1920.1080@1920.0.1920.1080" timestamp="1598136287234" />
|
||||
<state width="1292" height="330" key="GridCell.Tab.0.left" timestamp="1598136287234">
|
||||
<screen x="1920" y="0" width="1920" height="1080" />
|
||||
</state>
|
||||
<state width="908" height="298" key="GridCell.Tab.0.left/1920.0.1920.1080/0.0.1920.1080@1920.0.1920.1080" timestamp="1597956915348" />
|
||||
<state width="908" height="298" key="GridCell.Tab.0.right" timestamp="1597956915348">
|
||||
<state width="1292" height="330" key="GridCell.Tab.0.left/1920.0.1920.1080/0.0.1920.1080@1920.0.1920.1080" timestamp="1598136287234" />
|
||||
<state width="1292" height="330" key="GridCell.Tab.0.right" timestamp="1598136287234">
|
||||
<screen x="1920" y="0" width="1920" height="1080" />
|
||||
</state>
|
||||
<state width="908" height="298" key="GridCell.Tab.0.right/1920.0.1920.1080/0.0.1920.1080@1920.0.1920.1080" timestamp="1597956915348" />
|
||||
<state width="1868" height="383" key="GridCell.Tab.1.bottom" timestamp="1597955439042">
|
||||
<state width="1292" height="330" key="GridCell.Tab.0.right/1920.0.1920.1080/0.0.1920.1080@1920.0.1920.1080" timestamp="1598136287234" />
|
||||
<state width="1292" height="330" key="GridCell.Tab.1.bottom" timestamp="1598136287234">
|
||||
<screen x="1920" y="0" width="1920" height="1080" />
|
||||
</state>
|
||||
<state width="1868" height="383" key="GridCell.Tab.1.bottom/1920.0.1920.1080/0.0.1920.1080@1920.0.1920.1080" timestamp="1597955439042" />
|
||||
<state width="1868" height="383" key="GridCell.Tab.1.center" timestamp="1597955439042">
|
||||
<state width="1292" height="330" key="GridCell.Tab.1.bottom/1920.0.1920.1080/0.0.1920.1080@1920.0.1920.1080" timestamp="1598136287234" />
|
||||
<state width="1292" height="330" key="GridCell.Tab.1.center" timestamp="1598136287234">
|
||||
<screen x="1920" y="0" width="1920" height="1080" />
|
||||
</state>
|
||||
<state width="1868" height="383" key="GridCell.Tab.1.center/1920.0.1920.1080/0.0.1920.1080@1920.0.1920.1080" timestamp="1597955439042" />
|
||||
<state width="1868" height="383" key="GridCell.Tab.1.left" timestamp="1597955439042">
|
||||
<state width="1292" height="330" key="GridCell.Tab.1.center/1920.0.1920.1080/0.0.1920.1080@1920.0.1920.1080" timestamp="1598136287234" />
|
||||
<state width="1292" height="330" key="GridCell.Tab.1.left" timestamp="1598136287234">
|
||||
<screen x="1920" y="0" width="1920" height="1080" />
|
||||
</state>
|
||||
<state width="1868" height="383" key="GridCell.Tab.1.left/1920.0.1920.1080/0.0.1920.1080@1920.0.1920.1080" timestamp="1597955439042" />
|
||||
<state width="1868" height="383" key="GridCell.Tab.1.right" timestamp="1597955439042">
|
||||
<state width="1292" height="330" key="GridCell.Tab.1.left/1920.0.1920.1080/0.0.1920.1080@1920.0.1920.1080" timestamp="1598136287234" />
|
||||
<state width="1292" height="330" key="GridCell.Tab.1.right" timestamp="1598136287234">
|
||||
<screen x="1920" y="0" width="1920" height="1080" />
|
||||
</state>
|
||||
<state width="1868" height="383" key="GridCell.Tab.1.right/1920.0.1920.1080/0.0.1920.1080@1920.0.1920.1080" timestamp="1597955439042" />
|
||||
<state width="1868" height="383" key="GridCell.Tab.2.bottom" timestamp="1597955439042">
|
||||
<state width="1292" height="330" key="GridCell.Tab.1.right/1920.0.1920.1080/0.0.1920.1080@1920.0.1920.1080" timestamp="1598136287234" />
|
||||
<state width="1292" height="330" key="GridCell.Tab.2.bottom" timestamp="1598136287235">
|
||||
<screen x="1920" y="0" width="1920" height="1080" />
|
||||
</state>
|
||||
<state width="1868" height="383" key="GridCell.Tab.2.bottom/1920.0.1920.1080/0.0.1920.1080@1920.0.1920.1080" timestamp="1597955439042" />
|
||||
<state width="1868" height="383" key="GridCell.Tab.2.center" timestamp="1597955439042">
|
||||
<state width="1292" height="330" key="GridCell.Tab.2.bottom/1920.0.1920.1080/0.0.1920.1080@1920.0.1920.1080" timestamp="1598136287235" />
|
||||
<state width="1292" height="330" key="GridCell.Tab.2.center" timestamp="1598136287235">
|
||||
<screen x="1920" y="0" width="1920" height="1080" />
|
||||
</state>
|
||||
<state width="1868" height="383" key="GridCell.Tab.2.center/1920.0.1920.1080/0.0.1920.1080@1920.0.1920.1080" timestamp="1597955439042" />
|
||||
<state width="1868" height="383" key="GridCell.Tab.2.left" timestamp="1597955439042">
|
||||
<state width="1292" height="330" key="GridCell.Tab.2.center/1920.0.1920.1080/0.0.1920.1080@1920.0.1920.1080" timestamp="1598136287235" />
|
||||
<state width="1292" height="330" key="GridCell.Tab.2.left" timestamp="1598136287234">
|
||||
<screen x="1920" y="0" width="1920" height="1080" />
|
||||
</state>
|
||||
<state width="1868" height="383" key="GridCell.Tab.2.left/1920.0.1920.1080/0.0.1920.1080@1920.0.1920.1080" timestamp="1597955439042" />
|
||||
<state width="1868" height="383" key="GridCell.Tab.2.right" timestamp="1597955439042">
|
||||
<state width="1292" height="330" key="GridCell.Tab.2.left/1920.0.1920.1080/0.0.1920.1080@1920.0.1920.1080" timestamp="1598136287234" />
|
||||
<state width="1292" height="330" key="GridCell.Tab.2.right" timestamp="1598136287235">
|
||||
<screen x="1920" y="0" width="1920" height="1080" />
|
||||
</state>
|
||||
<state width="1868" height="383" key="GridCell.Tab.2.right/1920.0.1920.1080/0.0.1920.1080@1920.0.1920.1080" timestamp="1597955439042" />
|
||||
<state width="1868" height="383" key="GridCell.Tab.3.bottom" timestamp="1597955439042">
|
||||
<state width="1292" height="330" key="GridCell.Tab.2.right/1920.0.1920.1080/0.0.1920.1080@1920.0.1920.1080" timestamp="1598136287235" />
|
||||
<state width="1292" height="330" key="GridCell.Tab.3.bottom" timestamp="1598136287235">
|
||||
<screen x="1920" y="0" width="1920" height="1080" />
|
||||
</state>
|
||||
<state width="1868" height="383" key="GridCell.Tab.3.bottom/1920.0.1920.1080/0.0.1920.1080@1920.0.1920.1080" timestamp="1597955439042" />
|
||||
<state width="1868" height="383" key="GridCell.Tab.3.center" timestamp="1597955439042">
|
||||
<state width="1292" height="330" key="GridCell.Tab.3.bottom/1920.0.1920.1080/0.0.1920.1080@1920.0.1920.1080" timestamp="1598136287235" />
|
||||
<state width="1292" height="330" key="GridCell.Tab.3.center" timestamp="1598136287235">
|
||||
<screen x="1920" y="0" width="1920" height="1080" />
|
||||
</state>
|
||||
<state width="1868" height="383" key="GridCell.Tab.3.center/1920.0.1920.1080/0.0.1920.1080@1920.0.1920.1080" timestamp="1597955439042" />
|
||||
<state width="1868" height="383" key="GridCell.Tab.3.left" timestamp="1597955439042">
|
||||
<state width="1292" height="330" key="GridCell.Tab.3.center/1920.0.1920.1080/0.0.1920.1080@1920.0.1920.1080" timestamp="1598136287235" />
|
||||
<state width="1292" height="330" key="GridCell.Tab.3.left" timestamp="1598136287235">
|
||||
<screen x="1920" y="0" width="1920" height="1080" />
|
||||
</state>
|
||||
<state width="1868" height="383" key="GridCell.Tab.3.left/1920.0.1920.1080/0.0.1920.1080@1920.0.1920.1080" timestamp="1597955439042" />
|
||||
<state width="1868" height="383" key="GridCell.Tab.3.right" timestamp="1597955439042">
|
||||
<state width="1292" height="330" key="GridCell.Tab.3.left/1920.0.1920.1080/0.0.1920.1080@1920.0.1920.1080" timestamp="1598136287235" />
|
||||
<state width="1292" height="330" key="GridCell.Tab.3.right" timestamp="1598136287235">
|
||||
<screen x="1920" y="0" width="1920" height="1080" />
|
||||
</state>
|
||||
<state width="1868" height="383" key="GridCell.Tab.3.right/1920.0.1920.1080/0.0.1920.1080@1920.0.1920.1080" timestamp="1597955439042" />
|
||||
<state width="1292" height="330" key="GridCell.Tab.3.right/1920.0.1920.1080/0.0.1920.1080@1920.0.1920.1080" timestamp="1598136287235" />
|
||||
<state width="1868" height="383" key="GridCell.Tab.4.bottom" timestamp="1597955234640">
|
||||
<screen x="1920" y="0" width="1920" height="1080" />
|
||||
</state>
|
||||
|
|
@ -315,10 +341,10 @@
|
|||
<screen x="0" y="0" width="1920" height="1080" />
|
||||
</state>
|
||||
<state x="631" y="291" width="806" height="524" key="Rider.ProjectTemplateDialog.Size/1920.0.1920.1080/0.0.1920.1080@1920.0.1920.1080" timestamp="1597872082099" />
|
||||
<state x="2321" y="-64" width="709" height="485" key="RiderGenerateDialog" timestamp="1597956793201">
|
||||
<state x="2315" y="-106" width="709" height="485" key="RiderGenerateDialog" timestamp="1598127182892">
|
||||
<screen x="1920" y="0" width="1920" height="1080" />
|
||||
</state>
|
||||
<state x="2321" y="-64" width="709" height="485" key="RiderGenerateDialog/1920.0.1920.1080/0.0.1920.1080@1920.0.1920.1080" timestamp="1597956793201" />
|
||||
<state x="2315" y="-106" width="709" height="485" key="RiderGenerateDialog/1920.0.1920.1080/0.0.1920.1080@1920.0.1920.1080" timestamp="1598127182892" />
|
||||
<state x="2525" y="135" width="1031" height="724" key="SettingsEditor" timestamp="1597932248704">
|
||||
<screen x="1920" y="0" width="1920" height="1080" />
|
||||
</state>
|
||||
|
|
@ -335,10 +361,10 @@
|
|||
<screen x="1920" y="0" width="1920" height="1080" />
|
||||
</state>
|
||||
<state x="2182" y="199" width="432" height="650" key="com.intellij.openapi.editor.actions.MultiplePasteAction$ClipboardContentChooser/1920.0.1920.1080/0.0.1920.1080@1920.0.1920.1080" timestamp="1597510086756" />
|
||||
<state x="0" y="557" width="1920" height="523" key="dock-window-1" timestamp="1597960555163">
|
||||
<screen x="0" y="0" width="1920" height="1080" />
|
||||
<state x="3264" y="0" width="576" height="1080" key="dock-window-1" timestamp="1598127152431">
|
||||
<screen x="1920" y="0" width="1920" height="1080" />
|
||||
</state>
|
||||
<state x="0" y="557" width="1920" height="523" key="dock-window-1/1920.0.1920.1080/0.0.1920.1080@1920.0.1920.1080" timestamp="1597960555163" />
|
||||
<state x="3264" y="0" width="576" height="1080" key="dock-window-1/1920.0.1920.1080/0.0.1920.1080@1920.0.1920.1080" timestamp="1598127152431" />
|
||||
<state x="3200" y="0" width="640" height="1080" key="dock-window-2" timestamp="1597959520918">
|
||||
<screen x="1920" y="0" width="1920" height="1080" />
|
||||
</state>
|
||||
|
|
@ -352,4 +378,36 @@
|
|||
</state>
|
||||
<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 name="XDebuggerManager">
|
||||
<breakpoint-manager>
|
||||
<breakpoints>
|
||||
<line-breakpoint enabled="true" type="DotNet Breakpoints">
|
||||
<url>file://$PROJECT_DIR$/DevFunctions.cs</url>
|
||||
<line>86</line>
|
||||
<properties documentPath="$PROJECT_DIR$/DevFunctions.cs" initialLine="82">
|
||||
<startOffsets>
|
||||
<option value="2557" />
|
||||
</startOffsets>
|
||||
<endOffsets>
|
||||
<option value="2606" />
|
||||
</endOffsets>
|
||||
</properties>
|
||||
<option name="timeStamp" value="4" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="DotNet Breakpoints">
|
||||
<url>file://$PROJECT_DIR$/Parser/Parser.cs</url>
|
||||
<line>107</line>
|
||||
<properties documentPath="$PROJECT_DIR$/Parser/Parser.cs" initialLine="107">
|
||||
<startOffsets>
|
||||
<option value="3498" />
|
||||
</startOffsets>
|
||||
<endOffsets>
|
||||
<option value="3524" />
|
||||
</endOffsets>
|
||||
</properties>
|
||||
<option name="timeStamp" value="12" />
|
||||
</line-breakpoint>
|
||||
</breakpoints>
|
||||
</breakpoint-manager>
|
||||
</component>
|
||||
</project>
|
||||
|
|
@ -22,17 +22,24 @@ namespace Compiler
|
|||
case NodeType.UnaryOperatorNode:
|
||||
Console.WriteLine(indent + root.NodeType + ":" + ((UnaryOperatorNode) root).OperatorType);
|
||||
break;
|
||||
case NodeType.BinaryOperatorNode:
|
||||
Console.WriteLine(indent + root.NodeType + ":" + ((BinaryOperatorNode) root).OperatorType);
|
||||
break;
|
||||
|
||||
default:
|
||||
Console.WriteLine(indent + root.NodeType);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
foreach (Node child in root.Children)
|
||||
{
|
||||
if (child != null)
|
||||
{
|
||||
PrettyPrint(child, indent + " ");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void TestGenerator(Node root, int debugLevel)
|
||||
{
|
||||
|
|
@ -97,7 +104,7 @@ namespace Compiler
|
|||
|
||||
public static void DevMode()
|
||||
{
|
||||
for (int i = 1; i <= 2; i++)
|
||||
for (int i = 3; i <= 3; i++)
|
||||
{
|
||||
Console.WriteLine($"---------------------valid, stage {i}-------------------------------");
|
||||
foreach (string file in Directory.GetFiles($"/home/clemens/repositorys/lcc/stage_{i}/valid"))
|
||||
|
|
@ -105,7 +112,7 @@ namespace Compiler
|
|||
Console.WriteLine("-------------");
|
||||
List<Token> tokens = TestLexer(file, 0);
|
||||
Node programNode = TestParser(tokens, file, 1);
|
||||
TestGenerator(programNode, 1);
|
||||
//TestGenerator(programNode, 1);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -114,8 +121,8 @@ namespace Compiler
|
|||
{
|
||||
Console.WriteLine("-------------");
|
||||
List<Token> tokens = TestLexer(file, 0);
|
||||
Node programNode = TestParser(tokens, file, 0);
|
||||
TestGenerator(programNode, 1);
|
||||
Node programNode = TestParser(tokens, file, 1);
|
||||
//TestGenerator(programNode, 1);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,6 +50,9 @@ namespace Compiler.Lexer
|
|||
patterns.Add(new Pattern(@"^-", TokenType.NegationToken));
|
||||
patterns.Add(new Pattern(@"^~", TokenType.BitwiseComplementToken));
|
||||
patterns.Add(new Pattern(@"^!", TokenType.LogicalNegationToken));
|
||||
patterns.Add(new Pattern(@"^\+", TokenType.AdditionToken));
|
||||
patterns.Add(new Pattern(@"^\*", TokenType.MultiplicationToken));
|
||||
patterns.Add(new Pattern(@"^\/", TokenType.DivisionToken));
|
||||
|
||||
//try each pattern do determine if it is the one matching at the beginning
|
||||
//TODO: There sure is room for optimization here
|
||||
|
|
@ -90,6 +93,9 @@ namespace Compiler.Lexer
|
|||
case TokenType.BitwiseComplementToken:
|
||||
case TokenType.LogicalNegationToken:
|
||||
case TokenType.InvalidToken:
|
||||
case TokenType.AdditionToken:
|
||||
case TokenType.DivisionToken:
|
||||
case TokenType.MultiplicationToken:
|
||||
break;
|
||||
default:
|
||||
t.TokenType = TokenType.InvalidToken;
|
||||
|
|
|
|||
|
|
@ -17,6 +17,11 @@ namespace Compiler.Lexer
|
|||
BitwiseComplementToken,
|
||||
LogicalNegationToken,
|
||||
|
||||
//binary operators
|
||||
AdditionToken,
|
||||
MultiplicationToken,
|
||||
DivisionToken,
|
||||
|
||||
//special Token to represent invalid matches
|
||||
InvalidToken,
|
||||
}
|
||||
|
|
|
|||
15
Compiler/Parser/Nodes/BinaryOperatorNode.cs
Normal file
15
Compiler/Parser/Nodes/BinaryOperatorNode.cs
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
namespace Compiler.Parser.Nodes
|
||||
{
|
||||
public sealed class BinaryOperatorNode : Node
|
||||
{
|
||||
public override NodeType NodeType { get; set; }
|
||||
|
||||
public OperatorType OperatorType { get; set; }
|
||||
|
||||
public BinaryOperatorNode(OperatorType operatorType)
|
||||
{
|
||||
NodeType = NodeType.BinaryOperatorNode;
|
||||
OperatorType = operatorType;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -7,7 +7,7 @@ namespace Compiler.Parser.Nodes
|
|||
|
||||
public ConstantNode(int value)
|
||||
{
|
||||
this.NodeType = NodeType.ConstantNode;
|
||||
NodeType = NodeType.ConstantNode;
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,10 @@ namespace Compiler.Parser.Nodes
|
|||
ReturnStatementNode,
|
||||
ExpressionNode,
|
||||
ConstantNode,
|
||||
UnaryOperatorNode
|
||||
UnaryOperatorNode,
|
||||
BinaryOperatorNode,
|
||||
TermNode,
|
||||
FactorNode
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -6,5 +6,11 @@ namespace Compiler.Parser.Nodes
|
|||
Negation,
|
||||
BitwiseComplement,
|
||||
LogicalNegation,
|
||||
|
||||
//binary operators
|
||||
Addition,
|
||||
Subtraction,
|
||||
Multiplication,
|
||||
Division
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,5 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Compiler.Lexer;
|
||||
using Compiler.Parser.Exceptions;
|
||||
using Compiler.Parser.Nodes;
|
||||
|
|
@ -111,22 +110,118 @@ namespace Compiler.Parser
|
|||
throw new MissingTokenException(TokenType.IntegerLiteralToken);
|
||||
}
|
||||
|
||||
Node firstTerm = Parse(NodeType.TermNode);
|
||||
n = firstTerm;
|
||||
|
||||
Token expressionToken = _tokenList[0];
|
||||
|
||||
while (expressionToken.TokenType == TokenType.AdditionToken ||
|
||||
expressionToken.TokenType == TokenType.NegationToken)
|
||||
{
|
||||
_tokenList.RemoveAt(0);
|
||||
switch (expressionToken.TokenType)
|
||||
{
|
||||
case TokenType.AdditionToken:
|
||||
n = new BinaryOperatorNode(OperatorType.Addition);
|
||||
n.Children.Add(firstTerm);
|
||||
n.Children.Add(Parse(NodeType.TermNode));
|
||||
break;
|
||||
case TokenType.NegationToken:
|
||||
n = new BinaryOperatorNode(OperatorType.Subtraction);
|
||||
n.Children.Add(firstTerm);
|
||||
n.Children.Add(Parse(NodeType.TermNode));
|
||||
break;
|
||||
default:
|
||||
throw new Exception("WeirdException");
|
||||
}
|
||||
|
||||
if (_tokenList.Count > 0)
|
||||
{
|
||||
expressionToken = _tokenList[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new MissingTokenException(TokenType.IntegerLiteralToken);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case NodeType.TermNode:
|
||||
|
||||
|
||||
if (_tokenList.Count == 0)
|
||||
{
|
||||
throw new MissingTokenException(TokenType.IntegerLiteralToken);
|
||||
}
|
||||
|
||||
Node firstFactor = Parse(NodeType.FactorNode);
|
||||
n = firstFactor;
|
||||
|
||||
Token termToken = _tokenList[0];
|
||||
|
||||
while (termToken.TokenType == TokenType.MultiplicationToken ||
|
||||
termToken.TokenType == TokenType.DivisionToken)
|
||||
{
|
||||
_tokenList.RemoveAt(0);
|
||||
switch (termToken.TokenType)
|
||||
{
|
||||
case TokenType.MultiplicationToken:
|
||||
n = new BinaryOperatorNode(OperatorType.Multiplication);
|
||||
n.Children.Add(firstFactor);
|
||||
n.Children.Add(Parse(NodeType.FactorNode));
|
||||
break;
|
||||
|
||||
case TokenType.DivisionToken:
|
||||
n = new BinaryOperatorNode(OperatorType.Division);
|
||||
n.Children.Add(firstFactor);
|
||||
n.Children.Add(Parse(NodeType.FactorNode));
|
||||
break;
|
||||
default:
|
||||
throw new Exception("WeirdException");
|
||||
}
|
||||
|
||||
if (_tokenList.Count > 0)
|
||||
{
|
||||
termToken = _tokenList[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new MissingTokenException(TokenType.IntegerLiteralToken);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case NodeType.FactorNode:
|
||||
if (_tokenList.Count == 0)
|
||||
{
|
||||
throw new MissingTokenException(TokenType.IntegerLiteralToken);
|
||||
}
|
||||
|
||||
Token factorToken = _tokenList[0];
|
||||
|
||||
switch (factorToken.TokenType)
|
||||
{
|
||||
case TokenType.OpenParenthesisToken:
|
||||
CheckFirstTokenAndRemove(TokenType.OpenParenthesisToken);
|
||||
n = Parse(NodeType.ExpressionNode);
|
||||
CheckFirstTokenAndRemove(TokenType.CloseParenthesisToken);
|
||||
break;
|
||||
case TokenType.NegationToken:
|
||||
case TokenType.BitwiseComplementToken:
|
||||
case TokenType.LogicalNegationToken:
|
||||
n = Parse(NodeType.UnaryOperatorNode);
|
||||
n.Children.Add(Parse(NodeType.FactorNode));
|
||||
break;
|
||||
case TokenType.IntegerLiteralToken:
|
||||
n = Parse(NodeType.ConstantNode);
|
||||
break;
|
||||
case TokenType.BitwiseComplementToken:
|
||||
case TokenType.NegationToken:
|
||||
case TokenType.LogicalNegationToken:
|
||||
n = Parse(NodeType.UnaryOperatorNode);
|
||||
break;
|
||||
default:
|
||||
throw new UnexpectedTokenException(TokenType.IntegerLiteralToken,
|
||||
expressionToken.TokenType);
|
||||
factorToken.TokenType);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case NodeType.UnaryOperatorNode:
|
||||
|
|
@ -180,6 +275,7 @@ namespace Compiler.Parser
|
|||
_tokenList.RemoveAt(0);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
throw new Exception("Unknown Node Type " + nodeType);
|
||||
}
|
||||
|
|
|
|||
7
grammar
7
grammar
|
|
@ -1,5 +1,10 @@
|
|||
<program> ::= <function>
|
||||
<function> ::= "int" <id> "(" ")" "{" <statement> "}"
|
||||
<statement> ::= "return" <exp> ";"
|
||||
<exp> ::= <unary_op> <exp> | <int>
|
||||
<exp> ::= <term> { ("+" | "-") <term> }
|
||||
<term> ::= <factor> { ("*" | "/") <factor> }
|
||||
<factor> ::= "(" <exp> ")" | <unary_op> <factor> | <int>
|
||||
<unary_op> ::= "!" | "~" | "-"
|
||||
|
||||
------------
|
||||
6+5+2*(3-2)+9
|
||||
3
stage_3/invalid/malformed_paren.c
Normal file
3
stage_3/invalid/malformed_paren.c
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
int main() {
|
||||
return 2 (- 3);
|
||||
}
|
||||
3
stage_3/invalid/missing_first_op.c
Normal file
3
stage_3/invalid/missing_first_op.c
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
int main() {
|
||||
return /3;
|
||||
}
|
||||
3
stage_3/invalid/missing_second_op.c
Normal file
3
stage_3/invalid/missing_second_op.c
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
int main() {
|
||||
return 1 + ;
|
||||
}
|
||||
3
stage_3/invalid/no_semicolon.c
Normal file
3
stage_3/invalid/no_semicolon.c
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
int main() {
|
||||
return 2*2
|
||||
}
|
||||
3
stage_3/valid/add.c
Normal file
3
stage_3/valid/add.c
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
int main() {
|
||||
return 1 + 2;
|
||||
}
|
||||
3
stage_3/valid/associativity.c
Normal file
3
stage_3/valid/associativity.c
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
int main() {
|
||||
return 1 - 2 - 3;
|
||||
}
|
||||
3
stage_3/valid/associativity_2.c
Normal file
3
stage_3/valid/associativity_2.c
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
int main() {
|
||||
return 6 / 3 / 2;
|
||||
}
|
||||
3
stage_3/valid/div.c
Normal file
3
stage_3/valid/div.c
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
int main() {
|
||||
return 4 / 2;
|
||||
}
|
||||
3
stage_3/valid/div_neg.c
Normal file
3
stage_3/valid/div_neg.c
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
int main() {
|
||||
return (-12) / 5;
|
||||
}
|
||||
3
stage_3/valid/mult.c
Normal file
3
stage_3/valid/mult.c
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
int main() {
|
||||
return 2 * 3;
|
||||
}
|
||||
3
stage_3/valid/parens.c
Normal file
3
stage_3/valid/parens.c
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
int main() {
|
||||
return 2 * (3 + 4);
|
||||
}
|
||||
3
stage_3/valid/precedence.c
Normal file
3
stage_3/valid/precedence.c
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
int main() {
|
||||
return 2 + 3 * 4;
|
||||
}
|
||||
3
stage_3/valid/sub.c
Normal file
3
stage_3/valid/sub.c
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
int main() {
|
||||
return 1 - 2;
|
||||
}
|
||||
3
stage_3/valid/sub_neg.c
Normal file
3
stage_3/valid/sub_neg.c
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
int main() {
|
||||
return 2- -1;
|
||||
}
|
||||
3
stage_3/valid/unop_add.c
Normal file
3
stage_3/valid/unop_add.c
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
int main() {
|
||||
return ~2 + 3;
|
||||
}
|
||||
3
stage_3/valid/unop_parens.c
Normal file
3
stage_3/valid/unop_parens.c
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
int main() {
|
||||
return ~(1 + 1);
|
||||
}
|
||||
0
test
0
test
Loading…
Add table
Add a link
Reference in a new issue