Repository: Great-Li-Xin/LiXinCompiler
Branch: master
Commit: d1f816745f33
Files: 45
Total size: 93.2 KB
Directory structure:
gitextract_mfeb4nvw/
├── .idea/
│ ├── inspectionProfiles/
│ │ └── Project_Default.xml
│ ├── misc.xml
│ ├── modules.xml
│ ├── uiDesigner.xml
│ ├── vcs.xml
│ └── workspace.xml
├── LICENSE
├── LiXinCompiler.iml
├── README.md
└── src/
└── com/
└── lixin/
├── interpreter/
│ ├── Access.java
│ ├── And.java
│ ├── Arithmetic.java
│ ├── Break.java
│ ├── Constant.java
│ ├── Do.java
│ ├── Else.java
│ ├── Expression.java
│ ├── Identifier.java
│ ├── If.java
│ ├── Logical.java
│ ├── Node.java
│ ├── Not.java
│ ├── Operator.java
│ ├── Or.java
│ ├── Relation.java
│ ├── Sequence.java
│ ├── Set.java
│ ├── SetElem.java
│ ├── Statement.java
│ ├── Temp.java
│ ├── Unary.java
│ └── While.java
├── lexer/
│ ├── Lexer.java
│ ├── Numeric.java
│ ├── Real.java
│ ├── Tag.java
│ ├── Token.java
│ └── Word.java
├── main/
│ ├── Compiler.java
│ ├── CompilerTestDriver.java
│ └── Main.java
├── parser/
│ └── Parser.java
└── symbols/
├── Array.java
├── Environment.java
└── Type.java
================================================
FILE CONTENTS
================================================
================================================
FILE: .idea/inspectionProfiles/Project_Default.xml
================================================
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="JavaDoc" enabled="true" level="WARNING" enabled_by_default="true">
<option name="TOP_LEVEL_CLASS_OPTIONS">
<value>
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
<option name="REQUIRED_TAGS" value="" />
</value>
</option>
<option name="INNER_CLASS_OPTIONS">
<value>
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
<option name="REQUIRED_TAGS" value="" />
</value>
</option>
<option name="METHOD_OPTIONS">
<value>
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
<option name="REQUIRED_TAGS" value="@return@param@throws or @exception" />
</value>
</option>
<option name="FIELD_OPTIONS">
<value>
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
<option name="REQUIRED_TAGS" value="" />
</value>
</option>
<option name="IGNORE_DEPRECATED" value="false" />
<option name="IGNORE_JAVADOC_PERIOD" value="true" />
<option name="IGNORE_DUPLICATED_THROWS" value="false" />
<option name="IGNORE_POINT_TO_ITSELF" value="false" />
<option name="myAdditionalJavadocTags" value="date" />
</inspection_tool>
</profile>
</component>
================================================
FILE: .idea/misc.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="11" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>
================================================
FILE: .idea/modules.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/LiXinCompiler.iml" filepath="$PROJECT_DIR$/LiXinCompiler.iml" />
</modules>
</component>
</project>
================================================
FILE: .idea/uiDesigner.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Palette2">
<group name="Swing">
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
</item>
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
</item>
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
</item>
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
<initial-values>
<property name="text" value="Button" />
</initial-values>
</item>
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="RadioButton" />
</initial-values>
</item>
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="CheckBox" />
</initial-values>
</item>
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
<initial-values>
<property name="text" value="Label" />
</initial-values>
</item>
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
</item>
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
</item>
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
<preferred-size width="-1" height="20" />
</default-constraints>
</item>
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
</item>
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
</item>
</group>
</component>
</project>
================================================
FILE: .idea/vcs.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>
================================================
FILE: .idea/workspace.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="b0f6b19a-54cb-47c6-bec5-1b7298521fee" name="Default" comment="">
<change beforePath="$PROJECT_DIR$/.idea/misc.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/out/production/LiXinCompiler/com/lixin/interpreter/Access.class" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/out/production/LiXinCompiler/com/lixin/interpreter/And.class" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/out/production/LiXinCompiler/com/lixin/interpreter/Arithmetic.class" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/out/production/LiXinCompiler/com/lixin/interpreter/Break.class" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/out/production/LiXinCompiler/com/lixin/interpreter/Constant.class" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/out/production/LiXinCompiler/com/lixin/interpreter/Do.class" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/out/production/LiXinCompiler/com/lixin/interpreter/Else.class" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/out/production/LiXinCompiler/com/lixin/interpreter/Expression.class" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/out/production/LiXinCompiler/com/lixin/interpreter/Identifier.class" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/out/production/LiXinCompiler/com/lixin/interpreter/If.class" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/out/production/LiXinCompiler/com/lixin/interpreter/Logical.class" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/out/production/LiXinCompiler/com/lixin/interpreter/Node.class" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/out/production/LiXinCompiler/com/lixin/interpreter/Not.class" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/out/production/LiXinCompiler/com/lixin/interpreter/Operator.class" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/out/production/LiXinCompiler/com/lixin/interpreter/Or.class" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/out/production/LiXinCompiler/com/lixin/interpreter/Relation.class" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/out/production/LiXinCompiler/com/lixin/interpreter/Sequence.class" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/out/production/LiXinCompiler/com/lixin/interpreter/Set.class" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/out/production/LiXinCompiler/com/lixin/interpreter/SetElem.class" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/out/production/LiXinCompiler/com/lixin/interpreter/Statement.class" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/out/production/LiXinCompiler/com/lixin/interpreter/Temp.class" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/out/production/LiXinCompiler/com/lixin/interpreter/Unary.class" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/out/production/LiXinCompiler/com/lixin/interpreter/While.class" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/out/production/LiXinCompiler/com/lixin/lexer/Lexer.class" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/out/production/LiXinCompiler/com/lixin/lexer/Numeric.class" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/out/production/LiXinCompiler/com/lixin/lexer/Real.class" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/out/production/LiXinCompiler/com/lixin/lexer/Tag.class" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/out/production/LiXinCompiler/com/lixin/lexer/Token.class" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/out/production/LiXinCompiler/com/lixin/lexer/Word.class" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/out/production/LiXinCompiler/com/lixin/main/Compiler.class" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/out/production/LiXinCompiler/com/lixin/main/CompilerTestDriver.class" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/out/production/LiXinCompiler/com/lixin/main/Main.class" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/out/production/LiXinCompiler/com/lixin/parser/Parser.class" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/out/production/LiXinCompiler/com/lixin/symbols/Array.class" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/out/production/LiXinCompiler/com/lixin/symbols/Environment.class" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/out/production/LiXinCompiler/com/lixin/symbols/Type.class" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/src/com/lixin/main/Compiler.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/com/lixin/main/Compiler.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/com/lixin/main/CompilerTestDriver.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/com/lixin/main/CompilerTestDriver.java" afterDir="false" />
</list>
<ignored path="$PROJECT_DIR$/out/" />
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="FileEditorManager">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/com/lixin/main/Main.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="285">
<caret line="15" column="25" lean-forward="true" selection-start-line="15" selection-start-column="25" selection-end-line="15" selection-end-column="25" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/com/lixin/interpreter/Break.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="95">
<caret line="5" column="13" selection-start-line="5" selection-start-column="13" selection-end-line="5" selection-end-column="13" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/com/lixin/interpreter/Constant.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="38">
<caret line="2" column="7" lean-forward="true" selection-start-line="2" selection-start-column="7" selection-end-line="2" selection-end-column="7" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/com/lixin/symbols/Type.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="38">
<caret line="2" column="7" lean-forward="true" selection-start-line="2" selection-start-column="7" selection-end-line="2" selection-end-column="7" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/com/lixin/symbols/Environment.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="399">
<caret line="23" column="39" lean-forward="true" selection-start-line="23" selection-start-column="39" selection-end-line="23" selection-end-column="39" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/com/lixin/parser/Parser.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-3531">
<caret line="104" column="22" lean-forward="true" selection-start-line="104" selection-start-column="22" selection-end-line="104" selection-end-column="22" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/com/lixin/symbols/Array.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="133">
<caret line="7" column="13" selection-start-line="7" selection-start-column="13" selection-end-line="7" selection-end-column="13" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/src/com/lixin/main/CompilerTestDriver.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="285">
<caret line="15" column="23" lean-forward="true" selection-start-line="15" selection-start-column="23" selection-end-line="15" selection-end-column="23" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/com/lixin/interpreter/Do.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="133">
<caret line="7" column="13" selection-start-line="7" selection-start-column="13" selection-end-line="7" selection-end-column="13" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/com/lixin/main/Compiler.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="178">
<caret line="15" selection-start-line="15" selection-end-line="15" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
</leaf>
</component>
<component name="FileTemplateManagerImpl">
<option name="RECENT_TEMPLATES">
<list>
<option value="Class" />
</list>
</option>
</component>
<component name="FindInProjectRecents">
<findStrings>
<find>Temp</find>
<find>\n</find>
</findStrings>
<replaceStrings>
<replace>\r\n</replace>
</replaceStrings>
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="IdeDocumentHistory">
<option name="CHANGED_PATHS">
<list>
<option value="$PROJECT_DIR$/../Great-Li-Xin.github.io/source/_posts/LiXinCompiler.md" />
<option value="$PROJECT_DIR$/src/com/lixin/main/in.txt" />
<option value="$PROJECT_DIR$/src/com/lixin/main/Test.java" />
<option value="$PROJECT_DIR$/src/com/lixin/lexer/Lexer.java" />
<option value="$PROJECT_DIR$/src/com/lixin/main/Compiler.java" />
<option value="$PROJECT_DIR$/src/com/lixin/main/CompilerTestDriver.java" />
</list>
</option>
</component>
<component name="ProjectFrameBounds" extendedState="6">
<option name="y" value="22" />
<option name="width" value="1680" />
<option name="height" value="960" />
</component>
<component name="ProjectView">
<navigator proportions="" version="1">
<foldersAlwaysOnTop value="true" />
</navigator>
<panes>
<pane id="ProjectPane">
<subPane>
<expand>
<path>
<item name="LiXinCompiler" type="b2602c69:ProjectViewProjectNode" />
<item name="LiXinCompiler" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="LiXinCompiler" type="b2602c69:ProjectViewProjectNode" />
<item name="LiXinCompiler" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="LiXinCompiler" type="b2602c69:ProjectViewProjectNode" />
<item name="LiXinCompiler" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="lixin" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="LiXinCompiler" type="b2602c69:ProjectViewProjectNode" />
<item name="LiXinCompiler" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="lixin" type="462c0819:PsiDirectoryNode" />
<item name="interpreter" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="LiXinCompiler" type="b2602c69:ProjectViewProjectNode" />
<item name="LiXinCompiler" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="lixin" type="462c0819:PsiDirectoryNode" />
<item name="lexer" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="LiXinCompiler" type="b2602c69:ProjectViewProjectNode" />
<item name="LiXinCompiler" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="lixin" type="462c0819:PsiDirectoryNode" />
<item name="main" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="LiXinCompiler" type="b2602c69:ProjectViewProjectNode" />
<item name="LiXinCompiler" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="lixin" type="462c0819:PsiDirectoryNode" />
<item name="parser" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="LiXinCompiler" type="b2602c69:ProjectViewProjectNode" />
<item name="LiXinCompiler" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="lixin" type="462c0819:PsiDirectoryNode" />
<item name="symbols" type="462c0819:PsiDirectoryNode" />
</path>
</expand>
<select />
</subPane>
</pane>
<pane id="PackagesPane" />
<pane id="Scope" />
</panes>
</component>
<component name="PropertiesComponent">
<property name="SearchEverywhereHistoryKey" value="Temp	PSI	JAVA://com.lixin.lexer.Tag#TEMP emit	PSI	JAVA://com.lixin.interpreter.Node#emit" />
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="aspect.path.notification.shown" value="true" />
<property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1538548992947" />
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
<property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
<property name="nodejs_npm_path_reset_for_default_project" value="true" />
<property name="project.structure.last.edited" value="Modules" />
<property name="project.structure.proportion" value="0.0" />
<property name="project.structure.side.proportion" value="0.0" />
</component>
<component name="RunDashboard">
<option name="ruleStates">
<list>
<RuleState>
<option name="name" value="ConfigurationTypeDashboardGroupingRule" />
</RuleState>
<RuleState>
<option name="name" value="StatusDashboardGroupingRule" />
</RuleState>
</list>
</option>
</component>
<component name="RunManager" selected="Application.CompilerTestDriver">
<configuration default="true" type="AndroidRunConfigurationType" factoryName="Android App" singleton="true">
<module name="" />
<option name="DEPLOY" value="true" />
<option name="ARTIFACT_NAME" value="" />
<option name="PM_INSTALL_OPTIONS" value="" />
<option name="ACTIVITY_EXTRA_FLAGS" value="" />
<option name="MODE" value="default_activity" />
<option name="CLEAR_LOGCAT" value="false" />
<option name="SHOW_LOGCAT_AUTOMATICALLY" value="false" />
<option name="SKIP_NOOP_APK_INSTALLATIONS" value="true" />
<option name="FORCE_STOP_RUNNING_APP" value="true" />
<option name="TARGET_SELECTION_MODE" value="SHOW_DIALOG" />
<option name="USE_LAST_SELECTED_DEVICE" value="false" />
<option name="PREFERRED_AVD" value="" />
<option name="DEBUGGER_TYPE" value="Java" />
<Java />
<Profilers>
<option name="ADVANCED_PROFILING_ENABLED" value="false" />
</Profilers>
<option name="DEEP_LINK" value="" />
<option name="ACTIVITY_CLASS" value="" />
<method v="2">
<option name="Android.Gradle.BeforeRunTask" enabled="true" />
<option name="com.android.instantApps.provision.BeforeRunTask" enabled="true" clearCache="false" clearProvisionedDevices="false" />
</method>
</configuration>
<configuration default="true" type="AndroidTestRunConfigurationType" factoryName="Android Instrumented Tests" singleton="true">
<module name="" />
<option name="TESTING_TYPE" value="0" />
<option name="INSTRUMENTATION_RUNNER_CLASS" value="" />
<option name="METHOD_NAME" value="" />
<option name="CLASS_NAME" value="" />
<option name="PACKAGE_NAME" value="" />
<option name="EXTRA_OPTIONS" value="" />
<option name="CLEAR_LOGCAT" value="false" />
<option name="SHOW_LOGCAT_AUTOMATICALLY" value="false" />
<option name="SKIP_NOOP_APK_INSTALLATIONS" value="true" />
<option name="FORCE_STOP_RUNNING_APP" value="true" />
<option name="TARGET_SELECTION_MODE" value="SHOW_DIALOG" />
<option name="USE_LAST_SELECTED_DEVICE" value="false" />
<option name="PREFERRED_AVD" value="" />
<option name="DEBUGGER_TYPE" value="Java" />
<Java />
<Profilers>
<option name="ADVANCED_PROFILING_ENABLED" value="false" />
</Profilers>
<method v="2">
<option name="Android.Gradle.BeforeRunTask" enabled="true" />
<option name="com.android.instantApps.provision.BeforeRunTask" enabled="true" clearCache="false" clearProvisionedDevices="false" />
</method>
</configuration>
<configuration name="Compiler" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="com.lixin.main.Compiler" />
<module name="LiXinCompiler" />
<extension name="coverage">
<pattern>
<option name="PATTERN" value="com.lixin.main.*" />
<option name="ENABLED" value="true" />
</pattern>
</extension>
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<configuration name="CompilerTestDriver" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="com.lixin.main.CompilerTestDriver" />
<module name="LiXinCompiler" />
<extension name="coverage">
<pattern>
<option name="PATTERN" value="com.lixin.main.*" />
<option name="ENABLED" value="true" />
</pattern>
</extension>
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<configuration name="Main" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="com.lixin.main.Main" />
<module name="LiXinCompiler" />
<extension name="coverage">
<pattern>
<option name="PATTERN" value="com.lixin.main.*" />
<option name="ENABLED" value="true" />
</pattern>
</extension>
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<list>
<item itemvalue="Application.Main" />
<item itemvalue="Application.Compiler" />
<item itemvalue="Application.CompilerTestDriver" />
</list>
<recent_temporary>
<list>
<item itemvalue="Application.CompilerTestDriver" />
<item itemvalue="Application.Compiler" />
<item itemvalue="Application.Main" />
</list>
</recent_temporary>
</component>
<component name="SvnConfiguration">
<configuration />
</component>
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="b0f6b19a-54cb-47c6-bec5-1b7298521fee" name="Default" comment="" />
<created>1527577851234</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1527577851234</updated>
<workItem from="1527577852995" duration="9000" />
<workItem from="1527577894873" duration="465000" />
<workItem from="1527583157860" duration="116000" />
<workItem from="1527683150744" duration="5472000" />
<workItem from="1527727096029" duration="258000" />
<workItem from="1527728096063" duration="486000" />
<workItem from="1538548506950" duration="465000" />
</task>
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="7271000" />
</component>
<component name="ToolWindowManager">
<frame x="0" y="23" width="1680" height="959" extended-state="6" />
<editor active="true" />
<layout>
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.26800978" />
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
<window_info id="Designer" order="2" />
<window_info id="Image Layers" order="3" />
<window_info id="Capture Tool" order="4" />
<window_info id="UI Designer" order="5" />
<window_info id="Learn" order="6" />
<window_info id="Favorites" order="7" side_tool="true" />
<window_info anchor="bottom" id="Duplicate detector" weight="0.3298731" />
<window_info anchor="bottom" id="Message" order="0" />
<window_info anchor="bottom" id="Find" order="1" weight="0.32949308" />
<window_info anchor="bottom" id="Run" order="2" weight="0.32871974" />
<window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
<window_info anchor="bottom" id="TODO" order="6" />
<window_info anchor="bottom" id="Version Control" order="7" />
<window_info anchor="bottom" id="Database Changes" order="8" show_stripe_button="false" />
<window_info anchor="bottom" id="Terminal" order="9" />
<window_info anchor="bottom" id="Event Log" order="10" side_tool="true" />
<window_info anchor="bottom" id="Messages" order="11" weight="0.32871974" />
<window_info anchor="right" id="Maven" />
<window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
<window_info anchor="right" id="Palette" order="3" />
<window_info anchor="right" id="Capture Analysis" order="4" />
<window_info anchor="right" id="Theme Preview" order="5" />
<window_info anchor="right" id="Palette	" order="6" />
<window_info anchor="right" id="Database" order="7" />
<window_info anchor="right" id="Maven Projects" order="8" />
</layout>
</component>
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="1" />
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/../Great-Li-Xin.github.io/source/_posts/LiXinCompiler.md">
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
<state split_layout="SPLIT">
<first_editor relative-caret-position="19">
<caret line="59" column="9" selection-start-line="59" selection-start-column="9" selection-end-line="59" selection-end-column="9" />
</first_editor>
<second_editor />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/lixin/interpreter/Not.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="133">
<caret line="7" column="13" selection-start-line="7" selection-start-column="13" selection-end-line="7" selection-end-column="13" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/lixin/main/in.txt" />
<entry file="jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_172.jdk/Contents/Home/src.zip!/java/io/ByteArrayOutputStream.java" />
<entry file="file://$PROJECT_DIR$/src/com/lixin/interpreter/Logical.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="133">
<caret line="8" column="13" selection-start-line="8" selection-start-column="13" selection-end-line="8" selection-end-column="13" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/lixin/interpreter/Node.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="304">
<caret line="22" column="5" lean-forward="true" selection-start-line="22" selection-start-column="5" selection-end-line="22" selection-end-column="5" />
<folding>
<element signature="e#419#420#0" expanded="true" />
<element signature="e#466#467#0" expanded="true" />
<element signature="e#505#506#0" expanded="true" />
<element signature="e#554#555#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/lixin/interpreter/If.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="133">
<caret line="7" column="13" selection-start-line="7" selection-start-column="13" selection-end-line="7" selection-end-column="13" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/lixin/interpreter/Identifier.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="133">
<caret line="8" column="13" selection-start-line="8" selection-start-column="13" selection-end-line="8" selection-end-column="13" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/lixin/interpreter/Else.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-73">
<caret line="7" column="13" selection-start-line="7" selection-start-column="13" selection-end-line="7" selection-end-column="13" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/lixin/interpreter/Expression.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="193">
<caret line="31" column="14" selection-start-line="31" selection-start-column="14" selection-end-line="31" selection-end-column="14" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/lixin/interpreter/Operator.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="247">
<caret line="16" column="9" lean-forward="true" selection-start-line="16" selection-start-column="9" selection-end-line="16" selection-end-column="9" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/LiXinCompiler.iml">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/README.md">
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
<state split_layout="SPLIT">
<first_editor relative-caret-position="4161">
<caret line="219" selection-start-line="219" selection-end-line="227" selection-end-column="1" />
</first_editor>
<second_editor />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/lixin/interpreter/Temp.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="323">
<caret line="20" column="5" selection-start-line="20" selection-start-column="5" selection-end-line="20" selection-end-column="5" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/lixin/lexer/Lexer.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="2280">
<caret line="125" column="25" selection-start-line="125" selection-start-column="25" selection-end-line="125" selection-end-column="25" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/lixin/lexer/Tag.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="323">
<caret line="17" column="24" selection-start-line="17" selection-start-column="24" selection-end-line="17" selection-end-column="24" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/lixin/interpreter/While.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="133">
<caret line="7" column="13" selection-start-line="7" selection-start-column="13" selection-end-line="7" selection-end-column="13" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/lixin/interpreter/Access.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="38">
<caret line="2" column="7" lean-forward="true" selection-start-line="2" selection-start-column="7" selection-end-line="2" selection-end-column="7" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/lixin/interpreter/And.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="133">
<caret line="7" column="13" selection-start-line="7" selection-start-column="13" selection-end-line="7" selection-end-column="13" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/lixin/interpreter/Arithmetic.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="38">
<caret line="2" column="7" lean-forward="true" selection-start-line="2" selection-start-column="7" selection-end-line="2" selection-end-column="7" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/lixin/interpreter/Break.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="95">
<caret line="5" column="13" selection-start-line="5" selection-start-column="13" selection-end-line="5" selection-end-column="13" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/lixin/interpreter/Do.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="133">
<caret line="7" column="13" selection-start-line="7" selection-start-column="13" selection-end-line="7" selection-end-column="13" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/lixin/interpreter/Constant.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="38">
<caret line="2" column="7" lean-forward="true" selection-start-line="2" selection-start-column="7" selection-end-line="2" selection-end-column="7" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/lixin/symbols/Type.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="38">
<caret line="2" column="7" lean-forward="true" selection-start-line="2" selection-start-column="7" selection-end-line="2" selection-end-column="7" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/lixin/symbols/Environment.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="399">
<caret line="23" column="39" lean-forward="true" selection-start-line="23" selection-start-column="39" selection-end-line="23" selection-end-column="39" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/lixin/symbols/Array.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="133">
<caret line="7" column="13" selection-start-line="7" selection-start-column="13" selection-end-line="7" selection-end-column="13" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/lixin/parser/Parser.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-3531">
<caret line="104" column="22" lean-forward="true" selection-start-line="104" selection-start-column="22" selection-end-line="104" selection-end-column="22" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/lixin/main/Compiler.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="178">
<caret line="15" selection-start-line="15" selection-end-line="15" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/lixin/main/Main.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="285">
<caret line="15" column="25" lean-forward="true" selection-start-line="15" selection-start-column="25" selection-end-line="15" selection-end-column="25" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/com/lixin/main/CompilerTestDriver.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="285">
<caret line="15" column="23" lean-forward="true" selection-start-line="15" selection-start-column="23" selection-end-line="15" selection-end-column="23" />
</state>
</provider>
</entry>
</component>
<component name="masterDetails">
<states>
<state key="ArtifactsStructureConfigurable.UI">
<settings>
<artifact-editor />
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
<state key="FacetStructureConfigurable.UI">
<settings>
<last-edited>No facets are configured</last-edited>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
<state key="GlobalLibrariesConfigurable.UI">
<settings>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
<state key="JdkListConfigurable.UI">
<settings>
<last-edited>1.8</last-edited>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
<state key="ModuleStructureConfigurable.UI">
<settings>
<last-edited>LiXinCompiler</last-edited>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
<option value="0.6" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
<state key="ProjectJDKs.UI">
<settings>
<last-edited>11</last-edited>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
<state key="ProjectLibrariesConfigurable.UI">
<settings>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
</states>
</component>
</project>
================================================
FILE: LICENSE
================================================
MIT License
Copyright (c) 2018 李欣
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
================================================
FILE: LiXinCompiler.iml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
================================================
FILE: README.md
================================================
# LiXinCompiler
Referenced from the dragon-book, just a little implementation of the dragon-book language.
参考自龙书上的语言,自己实现了一个编译器的前端。
## GitHub链接
- [LiXinCompiler](https://github.com/realJustinLee/LiXinCompiler)
## 源语言
这个语言由一个程序和一个块组成,该块中包含可选的声名和语句。语法符号```basic```表示基本类型。
```
program -> block
block -> { declause statemets }
declause -> decaluse debracket | ϵ
debrcket -> type identity ;
type -> type [ num ] | basic
statements -> statements statement | ϵ
```
为了简化翻译工作,我们把赋值当成了一个语句.
```
statement -> location = bool ;
| if ( bool ) statement
| if ( bool ) stetement else statement
| while ( bool ) statement
| do statement while ( bool ) ;
| break ;
| block
location -> location [ bool ] | identity
```
表达式的产生式处理了运算符的结合性和优先级。它们对每个优先级都使用了一个非终结符号,而非终结符号```factor```用来表示括号中的表达式、标识符、数组引用和常量.
```
bool -> bool || join | join
join -> join && equality | equality
equality -> equality == relation | equality != relation | relation
relation -> expression < expression | expressoion <= expression |
expressoion >= expression | expressoion > expression | expression
expression -> expression + term | expression - term | term
term -> term * unary | term / unary | unary
factor -> ( bool ) | location | numeric | real | true | false
```
## 测试样例
### block:
输入
```
lxc>
{
int a; int b; a = 0; b = 0;
{
int b; b = 1;
{
int a; a = 2;
}
{
int b; b = 3;
}
a = a + 1; b = b + 1;
}
a = a + 1; b = b + 1;
}
```
输出
```
L1: a = 0
L3: b = 0
L4: b = 1
L6: a = 2
L7: b = 3
L8: a = a + 1
L9: b = b + 1
L5: a = a + 1
L10: b = b + 1
L2:
```
### expression:
输入
```
lxc>
{
int i; float x; bool b;
i = 0;
i = 365;
x = 0.0;
x = 3.14159;
b = true;
b = false;
i = x;
x = i;
}
```
输出
```
L1: i = 0
L3: i = 365
L4: x = 0.0
L5: x = 3.1415896
L6: b = true
L7: b = false
L8: i = x
L9: x = i
L2:
```
### identity:
输入
```
lxc>
{
int i; int j; float[10][10] a;
i = 0;
while ( i < 10 ) {
j = 0;
while ( j < 10 ) {
a[i][j] = 0.0;
j = j + 1;
}
i = i + 1;
}
i = 0;
while ( i < 10 ) {
a[i][i] = 1.0;
i = i + 1;
}
}
```
输出
```
L1: i = 0
L3: if not i < 10 goto L4
L5: j = 0
L6: if not j < 10 goto L7
L8: t1 = i * 80
t2 = j * 8
t3 = t1 + t2
a [ t3 ] = 0.0
L9: j = j + 1
goto L6
L7: i = i + 1
goto L3
L4: i = 0
L10: if not i < 10 goto L2
L11: t4 = i * 80
t5 = i * 8
t6 = t4 + t5
a [ t6 ] = 1.0
L12: i = i + 1
goto L10
L2:
```
### jump:
输入
```
lxc>
{
int x; int y; int a; int b;
if( true ) a = 0;
if( false ) x = 0;
if ( a < b ) a = b;
if ( x <= y ) x = y;
if ( a == b ) a = b;
if ( x != y ) x = y;
if ( a >= b ) b = a;
if ( x > y ) y = x;
if ( a == b );
if( x < 100 || x > 200 ) x = 0;
if( a < 100 && a > 200 ) b = 0;
if( x < 100 || (x > 200 && x != y) ) x = 0;
if( a < 100 || (a > 200 && a != 150) || a != 0 ) a = 0;
if( x > 200 && x != b || x < 100 ) x = 0;
if( a < 100 || a > 200 && a != b ) a = 0;
}
```
输出
```
L1:L4: a = 0
L3: goto L5
L6: x = 0
L5: if not a < b goto L7
L8: a = b
L7: if not x <= y goto L9
L10: x = y
L9: if not a == b goto L11
L12: a = b
L11: if not x != y goto L13
L14: x = y
L13: if not a >= b goto L15
L16: b = a
L15: if not x > y goto L17
L18: y = x
L17: if not a == b goto L19
L20:L19: if x < 100 goto L23
if not x > 200 goto L21
L23:L22: x = 0
L21: if not a < 100 goto L24
if not a > 200 goto L24
L25: b = 0
L24: if x < 100 goto L28
if not x > 200 goto L26
if not x != y goto L26
L28:L27: x = 0
L26: if a < 100 goto L31
if a != 150 goto L31
L32: if not a != 0 goto L29
L31:L30: a = 0
L29: if x != b goto L35
L36: if not x < 100 goto L33
L35:L34: x = 0
L33: if a < 100 goto L38
if not a > 200 goto L2
if not a != b goto L2
L38:L37: a = 0
L2:
```
### program:
输入
```
lxc>
{
int i; int j; float v; float x; float[100] a;
while( true ) {
do i = i+1; while( a[i] < v);
do j = j-1; while( a[j] > v);
if( i >= j ) break;
x = a[i]; a[i] = a[j]; a[j] = x;
}
}
```
输出
```
L1:L3: i = i + 1
L5: t1 = i * 8
t2 = a [ t1 ]
if t2 < v goto L3
L4: j = j - 1
L7: t3 = j * 8
t4 = a [ t3 ]
if t4 > v goto L4
L6: if not i >= j goto L8
L9: goto L2
L8: t5 = i * 8
x = a [ t5 ]
L10: t6 = i * 8
t7 = j * 8
t8 = a [ t7 ]
a [ t6 ] = t8
L11: t9 = j * 8
a [ t9 ] = x
goto L1
L2:
```
# 关于BUG、建议与意见
请在[GitHub](https://github.com/realJustinLee/LiXinCompiler)中提[issue](https://github.com/realJustinLee/LiXinCompiler/issues/new)
我会尽快回答
================================================
FILE: src/com/lixin/interpreter/Access.java
================================================
package com.lixin.interpreter;
import com.lixin.lexer.Tag;
import com.lixin.lexer.Word;
import com.lixin.symbols.Type;
/**
* @author lixin
*/
public class Access extends Operator {
Identifier array;
Expression index;
/**
* @param array 数组
* @param index 下标
* @param type 数组元素类型
*/
public Access(Identifier array, Expression index, Type type) {
super(new Word("[]", Tag.INDEX), type);
this.array = array;
this.index = index;
}
@Override
public Expression generate() {
return new Access(array, index.reduce(), type);
}
@Override
public void jumping(int positive, int negative) {
emitJumps(reduce().toString(), positive, negative);
}
@Override
public String toString() {
return array.toString() + " [ " + index.toString() + " ]";
}
}
================================================
FILE: src/com/lixin/interpreter/And.java
================================================
package com.lixin.interpreter;
import com.lixin.lexer.Token;
/**
* @author lixin
*/
public class And extends Logical {
public And(Token token, Expression expression1, Expression expression2) {
super(token, expression1, expression2);
}
@Override
public void jumping(int positive, int negative) {
int label = negative != 0 ? negative : newLabel();
expression1.jumping(0, negative);
expression2.jumping(positive, negative);
if (negative == 0) {
emitLabel(label);
}
}
}
================================================
FILE: src/com/lixin/interpreter/Arithmetic.java
================================================
package com.lixin.interpreter;
import com.lixin.lexer.Token;
import com.lixin.symbols.Type;
/**
* @author lixin
*/
public class Arithmetic extends Operator {
private Expression expression1, expression2;
public Arithmetic(Token token, Expression expression1, Expression expression2) {
super(token, null);
this.expression1 = expression1;
this.expression2 = expression2;
type = Type.max(expression1.type, expression2.type);
if (type == null) {
error("type error");
}
}
@Override
public Expression generate() {
return new Arithmetic(operator, expression1.reduce(), expression2.reduce());
}
@Override
public String toString() {
return expression1.toString() + " " + operator.toString() + " " + expression2.toString();
}
}
================================================
FILE: src/com/lixin/interpreter/Break.java
================================================
package com.lixin.interpreter;
/**
* @author lixin
*/
public class Break extends Statement {
private Statement statement;
public Break() {
if (Statement.ENCLOSING == Statement.NULL) {
error("unenclosed break");
}
statement = Statement.ENCLOSING;
}
@Override
public void generate(int begin, int first) {
emit("goto L" + statement.after);
}
}
================================================
FILE: src/com/lixin/interpreter/Constant.java
================================================
package com.lixin.interpreter;
import com.lixin.lexer.Numeric;
import com.lixin.lexer.Token;
import com.lixin.lexer.Word;
import com.lixin.symbols.Type;
/**
* @author lixin
*/
public class Constant extends Expression {
public Constant(Token token, Type type) {
super(token, type);
}
public Constant(int input) {
super(new Numeric(input), Type.INT);
}
public static final Constant
TRUE = new Constant(Word.TRUE, Type.BOOL),
FALSE = new Constant(Word.FALSE, Type.BOOL);
@Override
public void jumping(int positive, int negative) {
if (this == TRUE && positive != 0) {
emit("goto L" + positive);
} else if (this == FALSE && negative != 0) {
emit("goto L" + negative);
}
}
}
================================================
FILE: src/com/lixin/interpreter/Do.java
================================================
package com.lixin.interpreter;
import com.lixin.symbols.Type;
/**
* @author lixin
*/
public class Do extends Statement {
private Expression expression;
private Statement statement;
public Do() {
expression = null;
statement = null;
}
// public void init(Expression expression1, Statement statement)
public void init(Statement statement, Expression expression) {
this.statement = statement;
this.expression = expression;
if (expression.type != Type.BOOL) {
expression.error("boolean required in do");
}
}
@Override
public void generate(int begin, int first) {
after = first;
int label = newLabel();
statement.generate(begin, label);
emitLabel(label);
expression.jumping(begin, 0);
}
}
================================================
FILE: src/com/lixin/interpreter/Else.java
================================================
package com.lixin.interpreter;
import com.lixin.symbols.Type;
/**
* @author lixin
*/
public class Else extends Statement {
private Expression expression;
private Statement statement1;
private Statement statement2;
public Else(Expression expression, Statement statement1, Statement statement2) {
this.expression = expression;
this.statement1 = statement1;
this.statement2 = statement2;
if (expression.type != Type.BOOL) {
expression.error("boolean required in if");
}
}
@Override
public void generate(int begin, int first) {
int label1 = newLabel();
int label2 = newLabel();
expression.jumping(0, label2);
emitLabel(label1);
statement1.generate(label1, first);
emit("goto L" + first);
emitLabel(label2);
statement2.generate(label2, first);
}
}
================================================
FILE: src/com/lixin/interpreter/Expression.java
================================================
package com.lixin.interpreter;
import com.lixin.lexer.Token;
import com.lixin.symbols.Type;
/**
* @author lixin
*/
public class Expression extends Node {
Token operator;
public Type type;
Expression(Token operator, Type type) {
this.operator = operator;
this.type = type;
}
public Expression generate() {
return this;
}
public Expression reduce() {
return this;
}
public void jumping(int positive, int negative) {
emitJumps(toString(), positive, negative);
}
void emitJumps(String condition, int positive, int negative) {
if (positive != 0 && negative != 0) {
emit("if " + condition + " goto L" + positive);
emit("goto L" + negative);
} else if (positive != 0) {
emit("if " + condition + " goto L" + positive);
} else if (negative != 0) {
emit("if not " + condition + " goto L" + negative);
}
}
@Override
public String toString() {
return operator.toString();
}
}
================================================
FILE: src/com/lixin/interpreter/Identifier.java
================================================
package com.lixin.interpreter;
import com.lixin.lexer.Word;
import com.lixin.symbols.Type;
/**
* @author lixin
*/
public class Identifier extends Expression {
private int offset;
public Identifier(Word identifier, Type type, int offset) {
super(identifier, type);
this.offset = offset;
}
}
================================================
FILE: src/com/lixin/interpreter/If.java
================================================
package com.lixin.interpreter;
import com.lixin.symbols.Type;
/**
* @author lixin
*/
public class If extends Statement {
private Expression expression;
private Statement statement;
public If(Expression expression, Statement statement) {
this.expression = expression;
this.statement = statement;
if (expression.type != Type.BOOL) {
expression.error("boolean required in if");
}
}
@Override
public void generate(int begin, int first) {
// statement 的代码标号
int label = newLabel();
expression.jumping(0, first);
emitLabel(label);
statement.generate(label, first);
}
}
================================================
FILE: src/com/lixin/interpreter/Logical.java
================================================
package com.lixin.interpreter;
import com.lixin.lexer.Token;
import com.lixin.symbols.Type;
/**
* @author lixin
*/
public class Logical extends Expression {
Expression expression1, expression2;
Logical(Token token, Expression expression1, Expression expression2) {
super(token, null);
this.expression1 = expression1;
this.expression2 = expression2;
type = check(expression1.type, expression2.type);
if (type == null) {
error("type error");
}
}
public Type check(Type type1, Type type2) {
return type1 == Type.BOOL && type2 == Type.BOOL ? Type.BOOL : null;
}
@Override
public Expression generate() {
int negative = newLabel();
int after = newLabel();
Temp temp = new Temp(type);
this.jumping(0, negative);
emit(temp.toString() + " = true");
emit("goto L" + after);
emitLabel(negative);
emit(temp.toString() + " = false");
emitLabel(after);
return temp;
}
@Override
public String toString() {
return expression1.toString() + " " + operator.toString() + " " + expression2.toString();
}
}
================================================
FILE: src/com/lixin/interpreter/Node.java
================================================
package com.lixin.interpreter;
import com.lixin.lexer.Lexer;
/**
* @author lixin
*/
public class Node {
private int lexLine;
Node() {
lexLine = Lexer.line;
}
void error(String message) {
throw new Error("near line " + lexLine + ": " + message);
}
private static int labels = 0;
public int newLabel() {
return ++labels;
}
public void emitLabel(int i) {
System.out.print("L" + i + ":");
}
public void emit(String string) {
System.out.println("\t" + string);
}
}
================================================
FILE: src/com/lixin/interpreter/Not.java
================================================
package com.lixin.interpreter;
import com.lixin.lexer.Token;
/**
* @author lixin
*/
public class Not extends Logical {
public Not(Token token, Expression expression2) {
super(token, expression2, expression2);
}
@Override
public void jumping(int positive, int negative) {
expression2.jumping(negative, positive);
}
@Override
public String toString() {
return operator.toString() + " " + expression2.toString();
}
}
================================================
FILE: src/com/lixin/interpreter/Operator.java
================================================
package com.lixin.interpreter;
import com.lixin.lexer.Token;
import com.lixin.symbols.Type;
/**
* @author lixin
*/
public class Operator extends Expression {
Operator(Token token, Type type) {
super(token, type);
}
@Override
public Expression reduce() {
Expression expression = generate();
Temp temp = new Temp(type);
emit(temp.toString() + " = " + expression.toString());
return temp;
}
}
================================================
FILE: src/com/lixin/interpreter/Or.java
================================================
package com.lixin.interpreter;
import com.lixin.lexer.Token;
/**
* @author lixin
*/
public class Or extends Logical {
public Or(Token token, Expression expression1, Expression expression2) {
super(token, expression1, expression2);
}
@Override
public void jumping(int positive, int negative) {
int label = positive != 0 ? positive : newLabel();
expression1.jumping(label, 0);
expression2.jumping(positive, negative);
if (positive == 0) {
emitLabel(label);
}
}
}
================================================
FILE: src/com/lixin/interpreter/Relation.java
================================================
package com.lixin.interpreter;
import com.lixin.lexer.Token;
import com.lixin.symbols.Array;
import com.lixin.symbols.Type;
/**
* @author lixin
*/
public class Relation extends Logical {
public Relation(Token token, Expression expression1, Expression expression2) {
super(token, expression1, expression2);
}
@Override
public Type check(Type type1, Type type2) {
/*if (type1 instanceof Array || type2 instanceof Array) {
return null;
} else if (type1 == type2) {
return Type.BOOL;
} else {
return null;
}*/
return type1 instanceof Array || type2 instanceof Array ? null : type1 == type2 ? Type.BOOL : null;
}
@Override
public void jumping(int positive, int negative) {
Expression expressionA = expression1.reduce();
Expression expressionB = expression2.reduce();
String condition = expressionA.toString() + " " + operator.toString() + " " + expressionB.toString();
emitJumps(condition, positive, negative);
}
}
================================================
FILE: src/com/lixin/interpreter/Sequence.java
================================================
package com.lixin.interpreter;
/**
* @author lixin
*/
public class Sequence extends Statement {
private Statement statement1;
private Statement statement2;
public Sequence(Statement statement1, Statement statement2) {
this.statement1 = statement1;
this.statement2 = statement2;
}
@Override
public void generate(int begin, int first) {
if (statement1 == Statement.NULL) {
statement2.generate(begin, first);
} else if (statement2 == Statement.NULL) {
statement1.generate(begin, first);
} else {
int label = newLabel();
statement1.generate(begin, label);
emitLabel(label);
statement2.generate(label, first);
}
}
}
================================================
FILE: src/com/lixin/interpreter/Set.java
================================================
package com.lixin.interpreter;
import com.lixin.symbols.Type;
/**
* @author lixin
*/
public class Set extends Statement {
private Identifier identifier;
private Expression expression;
public Set(Identifier identifier, Expression expression) {
this.identifier = identifier;
this.expression = expression;
if (check(identifier.type, expression.type) == null) {
error("type error");
}
}
private Type check(Type type1, Type type2) {
/*if (Type.numeric(type1) && Type.numeric(type2)) {
return type2;
} else if (type1 == Type.BOOL && type2 == Type.BOOL) {
return type2;
} else {
return null;
}*/
return Type.numeric(type1) && Type.numeric(type2) || type1 == Type.BOOL && type2 == Type.BOOL ? type2 : null;
}
@Override
public void generate(int begin, int first) {
emit(identifier.toString() + " = " + expression.generate().toString());
}
}
================================================
FILE: src/com/lixin/interpreter/SetElem.java
================================================
package com.lixin.interpreter;
import com.lixin.symbols.Array;
import com.lixin.symbols.Type;
/**
* @author lixin
*/
public class SetElem extends Statement {
private Identifier array;
private Expression index;
private Expression expression;
public SetElem(Access access, Expression expression) {
array = access.array;
index = access.index;
this.expression = expression;
if (check(access.type, expression.type) == null) {
error("type error");
}
}
private Type check(Type type1, Type type2) {
/*if (type1 instanceof Array || type2 instanceof Array) {
return null;
} else if (type1 == type2) {
return type2;
} else if (Type.numeric(type1) && Type.numeric(type2)) {
return type2;
} else {
return null;
}*/
return type1 instanceof Array || type2 instanceof Array ? null : (type1 == type2) || (Type.numeric(type1) && Type.numeric(type2)) ? type2 : null;
}
@Override
public void generate(int begin, int first) {
String stringIndex = index.reduce().toString();
String stringExpression = expression.reduce().toString();
emit(array.toString() + " [ " + stringIndex + " ] = " + stringExpression);
}
}
================================================
FILE: src/com/lixin/interpreter/Statement.java
================================================
package com.lixin.interpreter;
/**
* @author lixin
*/
public class Statement extends Node {
public Statement() {
}
public static Statement NULL = new Statement();
/**
* @param begin 语句代码的开始处
* @param first 语句代码之后的第一条指令
*/
public void generate(int begin, int first) {
}
/**
* 保存语句的下一条指令的标号
*/
int after = 0;
/**
* 用于 break 语句
*/
public static Statement ENCLOSING = Statement.NULL;
}
================================================
FILE: src/com/lixin/interpreter/Temp.java
================================================
package com.lixin.interpreter;
import com.lixin.lexer.Word;
import com.lixin.symbols.Type;
/**
* @author lixin
*/
public class Temp extends Expression {
private static int count = 0;
private int number;
Temp(Type type) {
super(Word.TEMP, type);
number = ++count;
}
@Override
public String toString() {
return "t" + number;
}
}
================================================
FILE: src/com/lixin/interpreter/Unary.java
================================================
package com.lixin.interpreter;
import com.lixin.lexer.Token;
import com.lixin.symbols.Type;
/**
* @author lixin
*/
public class Unary extends Operator {
public Expression expression;
public Unary(Token token, Expression expression) {
super(token, null);
this.expression = expression;
type = Type.max(Type.INT, expression.type);
if (type == null) {
error("type error");
}
}
@Override
public Expression generate() {
return new Unary(operator, expression.reduce());
}
@Override
public String toString() {
return operator.toString() + " " + expression.toString();
}
}
================================================
FILE: src/com/lixin/interpreter/While.java
================================================
package com.lixin.interpreter;
import com.lixin.symbols.Type;
/**
* @author lixin
*/
public class While extends Statement {
private Expression expression;
private Statement statement;
public While() {
expression = null;
statement = null;
}
public void init(Expression expression, Statement statement) {
this.expression = expression;
this.statement = statement;
if (expression.type != Type.BOOL) {
expression.error("boolean required in while");
}
}
@Override
public void generate(int begin, int first) {
after = first;
expression.jumping(0, first);
int label = newLabel();
emitLabel(label);
statement.generate(label, begin);
emit("goto L" + begin);
}
}
================================================
FILE: src/com/lixin/lexer/Lexer.java
================================================
package com.lixin.lexer;
import com.lixin.symbols.Type;
import java.io.IOException;
import java.util.Hashtable;
/**
* @author lixin
*/
public class Lexer {
public static int line = 1;
private char peek = ' ';
private Hashtable<String, Word> words = new Hashtable<>();
private void reserve(Word word) {
words.put(word.lexeme, word);
}
public Lexer() {
reserve(new Word("if", Tag.IF));
reserve(new Word("else", Tag.ELSE));
reserve(new Word("while", Tag.WHILE));
reserve(new Word("do", Tag.DO));
reserve(new Word("break", Tag.BREAK));
reserve(Word.TRUE);
reserve(Word.FALSE);
reserve(Type.INT);
reserve(Type.CHAR);
reserve(Type.BOOL);
reserve(Type.FLOAT);
}
private void readChar() throws IOException {
peek = (char) System.in.read();
}
private boolean readChar(char c) throws IOException {
readChar();
if (peek != c) {
return false;
} else {
peek = ' ';
return true;
}
}
public Token scan() throws IOException {
/*
for (; ; readChar()) {
if (peek == ' ' || peek == '\t'|| peek == '\r') {
continue;
} else if (peek == '\n') {
line++;
} else {
break;
}
}
*/
outerLoop:
while (true) {
switch (peek) {
case ' ':
case '\t':
case '\r':
readChar();
continue;
case '\n':
line++;
break;
default:
break outerLoop;
}
readChar();
}
switch (peek) {
case '&':
return readChar('&') ? Word.AND : new Token('&');
case '|':
return readChar('|') ? Word.OR : new Token('|');
case '=':
return readChar('=') ? Word.EQUAL : new Token('=');
case '!':
return readChar('=') ? Word.NOT_EQUAL : new Token('!');
case '<':
return readChar('=') ? Word.LESS_EQUAL : new Token('<');
case '>':
return readChar('=') ? Word.GREATER_EQUAL : new Token('>');
default:
break;
}
if (Character.isDigit(peek)) {
int value = 0;
do {
value = 10 * value + Character.digit(peek, 10);
readChar();
} while (Character.isDigit(peek));
if (peek != '.') {
return new Numeric(value);
}
// float preciseValue = value;
float preciseValue;
// Base Multiplier 默认 Decimal
float baseMultiplier = 10;
/*
while (true) {
readChar();
if (!Character.isDigit(peek)) {
break;
}
preciseValue += Character.digit(peek, 10) / baseMultiplier;
baseMultiplier *= 10;
}
*/
// 若删除下句则float会解析错误
readChar();
for (preciseValue = value; Character.isDigit(peek); readChar()) {
preciseValue += Character.digit(peek, 10) / baseMultiplier;
baseMultiplier *= 10;
}
return new Real(preciseValue);
}
if (Character.isLetter(peek)) {
StringBuilder builder = new StringBuilder();
do {
builder.append(peek);
readChar();
} while (Character.isLetterOrDigit(peek));
String string = builder.toString();
Word word = words.get(string);
if (word != null) {
return word;
}
word = new Word(string, Tag.IDENTIFIER);
words.put(string, word);
return word;
}
Token token = new Token(peek);
peek = ' ';
return token;
}
}
================================================
FILE: src/com/lixin/lexer/Numeric.java
================================================
package com.lixin.lexer;
/**
* @author lixin
*/
public class Numeric extends Token {
public final int value;
public Numeric(int value) {
super(Tag.NUM);
this.value = value;
}
@Override
public String toString() {
return String.valueOf(value);
}
}
================================================
FILE: src/com/lixin/lexer/Real.java
================================================
package com.lixin.lexer;
/**
* @author lixin
*/
public class Real extends Token {
private final float value;
public Real(float value) {
super(Tag.REAL);
this.value = value;
}
@Override
public String toString() {
return String.valueOf(value);
}
}
================================================
FILE: src/com/lixin/lexer/Tag.java
================================================
package com.lixin.lexer;
/**
* @author lixin
*/
public class Tag {
public final static int
AND = 256,
BASIC = 257,
BREAK = 258,
DO = 259,
ELSE = 260,
EQUAL = 261,
FALSE = 262,
GREATER_EQUAL = 263,
IDENTIFIER = 264,
IF = 265,
INDEX = 266,
LESS_EQUAL = 267,
MINUS = 268,
NOT_EQUAL = 269,
NUM = 270,
OR = 271,
REAL = 272,
TEMP = 273,
TRUE = 274,
WHILE = 275;
}
================================================
FILE: src/com/lixin/lexer/Token.java
================================================
package com.lixin.lexer;
/**
* @author lixin
*/
public class Token {
public final int tag;
public Token(int tag) {
this.tag = tag;
}
@Override
public String toString() {
return String.valueOf((char) tag);
}
}
================================================
FILE: src/com/lixin/lexer/Word.java
================================================
package com.lixin.lexer;
/**
* @author lixin
*/
public class Word extends Token {
String lexeme;
public Word(String lexeme, int tag) {
super(tag);
this.lexeme = lexeme;
}
@Override
public String toString() {
return lexeme;
}
public static final Word
AND = new Word("&&", Tag.AND),
OR = new Word("||", Tag.OR),
EQUAL = new Word("==", Tag.EQUAL),
NOT_EQUAL = new Word("!=", Tag.NOT_EQUAL),
LESS_EQUAL = new Word("<=", Tag.LESS_EQUAL),
GREATER_EQUAL = new Word(">=", Tag.GREATER_EQUAL),
MINUS = new Word("-", Tag.MINUS),
TRUE = new Word("true", Tag.TRUE),
FALSE = new Word("false", Tag.FALSE),
TEMP = new Word("t", Tag.TEMP);
}
================================================
FILE: src/com/lixin/main/Compiler.java
================================================
package com.lixin.main;
import com.lixin.lexer.Lexer;
import com.lixin.parser.Parser;
import java.io.*;
/**
* @author lixin
*/
class Compiler {
void compile(File in, File out) {
InputStream sysIn = System.in;
PrintStream sysOut = System.out;
try {
FileInputStream fileInputStream = new FileInputStream(in);
System.setIn(fileInputStream);
FileOutputStream fileOutputStream = new FileOutputStream(out);
PrintStream printStream = new PrintStream(fileOutputStream);
System.setOut(printStream);
System.out.println("lxc>");
Lexer lexer = new Lexer();
Parser parser = new Parser(lexer);
parser.program();
System.out.println();
} catch (Exception e) {
e.printStackTrace();
} finally {
System.setIn(sysIn);
System.setOut(sysOut);
}
}
String compile(String in) {
InputStream sysIn = System.in;
PrintStream sysOut = System.out;
try {
ByteArrayInputStream inputStream = new ByteArrayInputStream(in.getBytes());
System.setIn(inputStream);
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
PrintStream printStream = new PrintStream(outputStream);
System.setOut(printStream);
System.out.println("lxc>");
Lexer lexer = new Lexer();
Parser parser = new Parser(lexer);
parser.program();
System.out.println();
return outputStream.toString();
} catch (Exception e) {
e.printStackTrace();
return null;
} finally {
System.setIn(sysIn);
System.setOut(sysOut);
}
}
}
================================================
FILE: src/com/lixin/main/CompilerTestDriver.java
================================================
package com.lixin.main;
import java.io.File;
/**
* @author lixin
*/
public class CompilerTestDriver {
public static void main(String[] args) {
Compiler compiler = new Compiler();
// 文件方法
File fileIn = new File("/Users/lixin/Downloads/in.txt");
File fileOut = new File("/Users/lixin/Downloads/out.txt");
compiler.compile(fileIn, fileOut);
// String 参数方法
String in = "{" +
"\tint i; int j; float v; float x; float[100] a;\r\n" +
"\twhile( true ) {\r\n" +
"\t\tdo i = i+1; while( a[i] < v);\r\n" +
"\t\tdo j = j-1; while( a[j] > v);\r\n" +
"\t\tif( i >= j ) break;\r\n" +
"\t\tx = a[i]; a[i] = a[j]; a[j] = x;\r\n" +
"\t}\r\n" +
"}\r\n" +
"{}";
String out = compiler.compile(in);
System.out.print(out);
}
}
================================================
FILE: src/com/lixin/main/Main.java
================================================
package com.lixin.main;
import com.lixin.lexer.Lexer;
import com.lixin.parser.Parser;
import java.io.IOException;
/**
* @author lixin
*/
public class Main {
public static void main(String[] args) throws IOException {
System.out.print("lxc>");
Lexer lexer = new Lexer();
Parser parser = new Parser(lexer);
parser.program();
System.out.println();
}
}
================================================
FILE: src/com/lixin/parser/Parser.java
================================================
package com.lixin.parser;
import com.lixin.interpreter.*;
import com.lixin.lexer.*;
import com.lixin.symbols.Array;
import com.lixin.symbols.Environment;
import com.lixin.symbols.Type;
import java.io.IOException;
/**
* @author lixin
*/
public class Parser {
private Lexer lexer;
private Token look;
private Environment top = null;
private int used = 0;
public Parser(Lexer lexer) throws IOException {
this.lexer = lexer;
move();
}
private void move() throws IOException {
look = lexer.scan();
}
private void error(String message) {
throw new Error("near line " + Lexer.line + ": " + message);
}
private void match(int tag) throws IOException {
if (look.tag == tag) {
move();
} else {
error("syntax error");
}
}
public void program() throws IOException {
Statement statement = block();
int begin = statement.newLabel();
int after = statement.newLabel();
statement.emitLabel(begin);
statement.generate(begin, after);
statement.emitLabel(after);
}
private Statement block() throws IOException {
match('{');
Environment savedEnvironment = top;
top = new Environment(top);
deClause();
Statement statement = statements();
match('}');
top = savedEnvironment;
return statement;
}
private void deClause() throws IOException {
while (look.tag == Tag.BASIC) {
Type type = type();
Token token = look;
match(Tag.IDENTIFIER);
match(';');
Identifier identifier = new Identifier((Word) token, type, used);
top.put(token, identifier);
used += type.width;
}
}
private Type type() throws IOException {
Type type = (Type) look;
match(Tag.BASIC);
if (look.tag != '[') {
return type;
} else {
return deBracket(type);
}
}
/**
* Original Name: dims
*/
private Type deBracket(Type type) throws IOException {
match('[');
Token token = look;
match(Tag.NUM);
match(']');
if (look.tag == '[') {
type = deBracket(type);
}
return new Array(((Numeric) token).value, type);
}
private Statement statements() throws IOException {
if (look.tag == '}') {
return Statement.NULL;
} else {
return new Sequence(statement(), statements());
}
}
private Statement statement() throws IOException {
Expression expression;
// Statement statement;
Statement statement1, statement2;
Statement savedStatement;
switch (look.tag) {
case ';':
move();
return Statement.NULL;
case Tag.IF:
match(Tag.IF);
match('(');
expression = bool();
match(')');
statement1 = statement();
if (look.tag != Tag.FALSE) {
return new If(expression, statement1);
}
match(Tag.FALSE);
statement2 = statement();
return new Else(expression, statement1, statement2);
case Tag.WHILE:
While whileNode = new While();
savedStatement = Statement.ENCLOSING;
Statement.ENCLOSING = whileNode;
match(Tag.WHILE);
match('(');
expression = bool();
match(')');
statement1 = statement();
whileNode.init(expression, statement1);
Statement.ENCLOSING = savedStatement;
return whileNode;
case Tag.DO:
Do doNode = new Do();
savedStatement = Statement.ENCLOSING;
Statement.ENCLOSING = doNode;
match(Tag.DO);
statement1 = statement();
match(Tag.WHILE);
match('(');
expression = bool();
match(')');
match(';');
doNode.init(statement1, expression);
Statement.ENCLOSING = savedStatement;
return doNode;
case Tag.BREAK:
match(Tag.BREAK);
match(';');
return new Break();
case '{':
return block();
default:
return assign();
}
}
private Statement assign() throws IOException {
Statement statement;
Token token = look;
match(Tag.IDENTIFIER);
Identifier identifier = top.get(token);
if (identifier == null) {
error(token.toString() + " undeclared");
}
if (look.tag == '=') {
move();
statement = new Set(identifier, bool());
} else {
Access access = offset(identifier);
match('=');
statement = new SetElem(access, bool());
}
match(';');
return statement;
}
private Expression bool() throws IOException {
Expression expression = join();
while (look.tag == Tag.OR) {
Token token = look;
move();
expression = new Or(token, expression, join());
}
return expression;
}
private Expression join() throws IOException {
Expression expression = equality();
while (look.tag == Tag.AND) {
Token token = look;
move();
expression = new And(token, expression, equality());
}
return expression;
}
private Expression equality() throws IOException {
Expression expression = relation();
while (look.tag == Tag.EQUAL || look.tag == Tag.NOT_EQUAL) {
Token token = look;
move();
return new Relation(token, expression, relation());
}
return expression;
}
private Expression relation() throws IOException {
Expression expression = expression();
switch (look.tag) {
case '<':
case Tag.LESS_EQUAL:
case Tag.GREATER_EQUAL:
case '>':
Token token = look;
move();
return new Relation(token, expression, expression());
default:
return expression;
}
}
private Expression expression() throws IOException {
Expression expression = term();
while (look.tag == '+' || look.tag == '-') {
Token token = look;
move();
return new Arithmetic(token, expression, term());
}
return expression;
}
private Expression term() throws IOException {
Expression expression = unary();
while (look.tag == '*' || look.tag == '/') {
Token token = look;
move();
return new Arithmetic(token, expression, unary());
}
return expression;
}
private Expression unary() throws IOException {
if (look.tag == '-') {
move();
return new Unary(Word.MINUS, unary());
} else if (look.tag == '!') {
Token token = look;
move();
return new Not(token, unary());
} else {
return factor();
}
}
private Expression factor() throws IOException {
Expression expression = null;
switch (look.tag) {
case '(':
move();
expression = bool();
match(')');
return expression;
case Tag.NUM:
expression = new Constant(look, Type.INT);
move();
return expression;
case Tag.REAL:
expression = new Constant(look, Type.FLOAT);
move();
return expression;
case Tag.TRUE:
expression = Constant.TRUE;
move();
return expression;
case Tag.FALSE:
expression = Constant.FALSE;
move();
return expression;
case Tag.IDENTIFIER:
// String stringLook = look.toString(); 没用
Identifier identifier = top.get(look);
if (identifier == null) {
error(look.toString() + " undeclared");
}
move();
if (look.tag != '[') {
return identifier;
} else {
return offset(identifier);
}
default:
error("syntax error");
return expression;
}
}
private Access offset(Identifier array) throws IOException {
Expression index;
Expression width;
Expression token1, token2;
Expression location;
Type type = array.type;
match('[');
index = bool();
match(']');
type = ((Array) type).of;
width = new Constant(type.width);
token1 = new Arithmetic(new Token('*'), index, width);
location = token1;
while (look.tag == '[') {
match('[');
index = bool();
match(']');
type = ((Array) type).of;
width = new Constant(type.width);
token1 = new Arithmetic(new Token('*'), index, width);
token2 = new Arithmetic(new Token('+'), location, token1);
location = token2;
}
return new Access(array, location, type);
}
}
================================================
FILE: src/com/lixin/symbols/Array.java
================================================
package com.lixin.symbols;
import com.lixin.lexer.Tag;
/**
* @author lixin
*/
public class Array extends Type {
public Type of;
private int size;
public Array(int size, Type type) {
super("[]", Tag.INDEX, size * type.width);
this.size = size;
of = type;
}
@Override
public String toString() {
return "[" + size + "]" + of.toString();
}
}
================================================
FILE: src/com/lixin/symbols/Environment.java
================================================
package com.lixin.symbols;
import com.lixin.interpreter.Identifier;
import com.lixin.lexer.Token;
import java.util.Hashtable;
/**
* @author lixin
*/
public class Environment {
private Hashtable<Token, Identifier> table;
private Environment previousEnvironment;
public Environment(Environment environment) {
table = new Hashtable<>();
previousEnvironment = environment;
}
public void put(Token word, Identifier identifier) {
table.put(word, identifier);
}
public Identifier get(Token word) {
for (Environment environment = this; environment != null; environment = environment.previousEnvironment) {
Identifier found = (environment.table.get(word));
if (found != null) {
return found;
}
}
return null;
}
}
================================================
FILE: src/com/lixin/symbols/Type.java
================================================
package com.lixin.symbols;
import com.lixin.lexer.Tag;
import com.lixin.lexer.Word;
import java.util.Arrays;
/**
* @author lixin
*/
public class Type extends Word {
public int width;
public Type(String lexeme, int tag, int width) {
super(lexeme, tag);
this.width = width;
}
public static final Type
INT = new Type("int", Tag.BASIC, 4),
FLOAT = new Type("float", Tag.BASIC, 8),
CHAR = new Type("char", Tag.BASIC, 1),
BOOL = new Type("bool", Tag.BASIC, 1);
public static boolean numeric(Type type) {
return Arrays.asList(new Type[]{FLOAT, INT, FLOAT}).contains(type);
}
public static Type max(Type type1, Type type2) {
/*The explanation of the working codes.
if (!numeric(type1) || !numeric(type2)) {
return null;
} else if (type1 == Type.FLOAT || type2 == FLOAT) {
return Type.FLOAT;
} else if (type1 == Type.INT || type2 == Type.INT) {
return Type.INT;
} else {
return Type.CHAR;
}*/
return numeric(type1) && numeric(type2) ? type1 == FLOAT || type2 == FLOAT ? FLOAT : type1 == INT || type2 == INT ? INT : CHAR : null;
}
}
gitextract_mfeb4nvw/
├── .idea/
│ ├── inspectionProfiles/
│ │ └── Project_Default.xml
│ ├── misc.xml
│ ├── modules.xml
│ ├── uiDesigner.xml
│ ├── vcs.xml
│ └── workspace.xml
├── LICENSE
├── LiXinCompiler.iml
├── README.md
└── src/
└── com/
└── lixin/
├── interpreter/
│ ├── Access.java
│ ├── And.java
│ ├── Arithmetic.java
│ ├── Break.java
│ ├── Constant.java
│ ├── Do.java
│ ├── Else.java
│ ├── Expression.java
│ ├── Identifier.java
│ ├── If.java
│ ├── Logical.java
│ ├── Node.java
│ ├── Not.java
│ ├── Operator.java
│ ├── Or.java
│ ├── Relation.java
│ ├── Sequence.java
│ ├── Set.java
│ ├── SetElem.java
│ ├── Statement.java
│ ├── Temp.java
│ ├── Unary.java
│ └── While.java
├── lexer/
│ ├── Lexer.java
│ ├── Numeric.java
│ ├── Real.java
│ ├── Tag.java
│ ├── Token.java
│ └── Word.java
├── main/
│ ├── Compiler.java
│ ├── CompilerTestDriver.java
│ └── Main.java
├── parser/
│ └── Parser.java
└── symbols/
├── Array.java
├── Environment.java
└── Type.java
SYMBOL INDEX (147 symbols across 36 files)
FILE: src/com/lixin/interpreter/Access.java
class Access (line 10) | public class Access extends Operator {
method Access (line 19) | public Access(Identifier array, Expression index, Type type) {
method generate (line 25) | @Override
method jumping (line 30) | @Override
method toString (line 35) | @Override
FILE: src/com/lixin/interpreter/And.java
class And (line 8) | public class And extends Logical {
method And (line 9) | public And(Token token, Expression expression1, Expression expression2) {
method jumping (line 13) | @Override
FILE: src/com/lixin/interpreter/Arithmetic.java
class Arithmetic (line 9) | public class Arithmetic extends Operator {
method Arithmetic (line 12) | public Arithmetic(Token token, Expression expression1, Expression expr...
method generate (line 22) | @Override
method toString (line 27) | @Override
FILE: src/com/lixin/interpreter/Break.java
class Break (line 6) | public class Break extends Statement {
method Break (line 9) | public Break() {
method generate (line 16) | @Override
FILE: src/com/lixin/interpreter/Constant.java
class Constant (line 11) | public class Constant extends Expression {
method Constant (line 12) | public Constant(Token token, Type type) {
method Constant (line 16) | public Constant(int input) {
method jumping (line 24) | @Override
FILE: src/com/lixin/interpreter/Do.java
class Do (line 8) | public class Do extends Statement {
method Do (line 12) | public Do() {
method init (line 19) | public void init(Statement statement, Expression expression) {
method generate (line 27) | @Override
FILE: src/com/lixin/interpreter/Else.java
class Else (line 8) | public class Else extends Statement {
method Else (line 13) | public Else(Expression expression, Statement statement1, Statement sta...
method generate (line 22) | @Override
FILE: src/com/lixin/interpreter/Expression.java
class Expression (line 9) | public class Expression extends Node {
method Expression (line 13) | Expression(Token operator, Type type) {
method generate (line 18) | public Expression generate() {
method reduce (line 22) | public Expression reduce() {
method jumping (line 26) | public void jumping(int positive, int negative) {
method emitJumps (line 30) | void emitJumps(String condition, int positive, int negative) {
method toString (line 41) | @Override
FILE: src/com/lixin/interpreter/Identifier.java
class Identifier (line 9) | public class Identifier extends Expression {
method Identifier (line 12) | public Identifier(Word identifier, Type type, int offset) {
FILE: src/com/lixin/interpreter/If.java
class If (line 8) | public class If extends Statement {
method If (line 12) | public If(Expression expression, Statement statement) {
method generate (line 20) | @Override
FILE: src/com/lixin/interpreter/Logical.java
class Logical (line 9) | public class Logical extends Expression {
method Logical (line 12) | Logical(Token token, Expression expression1, Expression expression2) {
method check (line 22) | public Type check(Type type1, Type type2) {
method generate (line 26) | @Override
method toString (line 40) | @Override
FILE: src/com/lixin/interpreter/Node.java
class Node (line 8) | public class Node {
method Node (line 11) | Node() {
method error (line 15) | void error(String message) {
method newLabel (line 21) | public int newLabel() {
method emitLabel (line 25) | public void emitLabel(int i) {
method emit (line 29) | public void emit(String string) {
FILE: src/com/lixin/interpreter/Not.java
class Not (line 8) | public class Not extends Logical {
method Not (line 9) | public Not(Token token, Expression expression2) {
method jumping (line 13) | @Override
method toString (line 18) | @Override
FILE: src/com/lixin/interpreter/Operator.java
class Operator (line 9) | public class Operator extends Expression {
method Operator (line 10) | Operator(Token token, Type type) {
method reduce (line 14) | @Override
FILE: src/com/lixin/interpreter/Or.java
class Or (line 8) | public class Or extends Logical {
method Or (line 9) | public Or(Token token, Expression expression1, Expression expression2) {
method jumping (line 13) | @Override
FILE: src/com/lixin/interpreter/Relation.java
class Relation (line 10) | public class Relation extends Logical {
method Relation (line 11) | public Relation(Token token, Expression expression1, Expression expres...
method check (line 15) | @Override
method jumping (line 27) | @Override
FILE: src/com/lixin/interpreter/Sequence.java
class Sequence (line 6) | public class Sequence extends Statement {
method Sequence (line 10) | public Sequence(Statement statement1, Statement statement2) {
method generate (line 15) | @Override
FILE: src/com/lixin/interpreter/Set.java
class Set (line 8) | public class Set extends Statement {
method Set (line 12) | public Set(Identifier identifier, Expression expression) {
method check (line 20) | private Type check(Type type1, Type type2) {
method generate (line 31) | @Override
FILE: src/com/lixin/interpreter/SetElem.java
class SetElem (line 9) | public class SetElem extends Statement {
method SetElem (line 14) | public SetElem(Access access, Expression expression) {
method check (line 23) | private Type check(Type type1, Type type2) {
method generate (line 36) | @Override
FILE: src/com/lixin/interpreter/Statement.java
class Statement (line 6) | public class Statement extends Node {
method Statement (line 7) | public Statement() {
method generate (line 16) | public void generate(int begin, int first) {
FILE: src/com/lixin/interpreter/Temp.java
class Temp (line 9) | public class Temp extends Expression {
method Temp (line 13) | Temp(Type type) {
method toString (line 18) | @Override
FILE: src/com/lixin/interpreter/Unary.java
class Unary (line 9) | public class Unary extends Operator {
method Unary (line 12) | public Unary(Token token, Expression expression) {
method generate (line 21) | @Override
method toString (line 26) | @Override
FILE: src/com/lixin/interpreter/While.java
class While (line 8) | public class While extends Statement {
method While (line 12) | public While() {
method init (line 17) | public void init(Expression expression, Statement statement) {
method generate (line 25) | @Override
FILE: src/com/lixin/lexer/Lexer.java
class Lexer (line 11) | public class Lexer {
method reserve (line 16) | private void reserve(Word word) {
method Lexer (line 20) | public Lexer() {
method readChar (line 34) | private void readChar() throws IOException {
method readChar (line 38) | private boolean readChar(char c) throws IOException {
method scan (line 48) | public Token scan() throws IOException {
FILE: src/com/lixin/lexer/Numeric.java
class Numeric (line 6) | public class Numeric extends Token {
method Numeric (line 9) | public Numeric(int value) {
method toString (line 14) | @Override
FILE: src/com/lixin/lexer/Real.java
class Real (line 6) | public class Real extends Token {
method Real (line 9) | public Real(float value) {
method toString (line 14) | @Override
FILE: src/com/lixin/lexer/Tag.java
class Tag (line 6) | public class Tag {
FILE: src/com/lixin/lexer/Token.java
class Token (line 6) | public class Token {
method Token (line 9) | public Token(int tag) {
method toString (line 13) | @Override
FILE: src/com/lixin/lexer/Word.java
class Word (line 6) | public class Word extends Token {
method Word (line 9) | public Word(String lexeme, int tag) {
method toString (line 14) | @Override
FILE: src/com/lixin/main/Compiler.java
class Compiler (line 11) | class Compiler {
method compile (line 12) | void compile(File in, File out) {
method compile (line 34) | String compile(String in) {
FILE: src/com/lixin/main/CompilerTestDriver.java
class CompilerTestDriver (line 8) | public class CompilerTestDriver {
method main (line 9) | public static void main(String[] args) {
FILE: src/com/lixin/main/Main.java
class Main (line 11) | public class Main {
method main (line 12) | public static void main(String[] args) throws IOException {
FILE: src/com/lixin/parser/Parser.java
class Parser (line 14) | public class Parser {
method Parser (line 20) | public Parser(Lexer lexer) throws IOException {
method move (line 25) | private void move() throws IOException {
method error (line 29) | private void error(String message) {
method match (line 33) | private void match(int tag) throws IOException {
method program (line 41) | public void program() throws IOException {
method block (line 50) | private Statement block() throws IOException {
method deClause (line 61) | private void deClause() throws IOException {
method type (line 73) | private Type type() throws IOException {
method deBracket (line 86) | private Type deBracket(Type type) throws IOException {
method statements (line 97) | private Statement statements() throws IOException {
method statement (line 105) | private Statement statement() throws IOException {
method assign (line 163) | private Statement assign() throws IOException {
method bool (line 183) | private Expression bool() throws IOException {
method join (line 193) | private Expression join() throws IOException {
method equality (line 203) | private Expression equality() throws IOException {
method relation (line 213) | private Expression relation() throws IOException {
method expression (line 228) | private Expression expression() throws IOException {
method term (line 238) | private Expression term() throws IOException {
method unary (line 248) | private Expression unary() throws IOException {
method factor (line 261) | private Expression factor() throws IOException {
method offset (line 303) | private Access offset(Identifier array) throws IOException {
FILE: src/com/lixin/symbols/Array.java
class Array (line 8) | public class Array extends Type {
method Array (line 12) | public Array(int size, Type type) {
method toString (line 18) | @Override
FILE: src/com/lixin/symbols/Environment.java
class Environment (line 11) | public class Environment {
method Environment (line 15) | public Environment(Environment environment) {
method put (line 20) | public void put(Token word, Identifier identifier) {
method get (line 24) | public Identifier get(Token word) {
FILE: src/com/lixin/symbols/Type.java
class Type (line 11) | public class Type extends Word {
method Type (line 14) | public Type(String lexeme, int tag, int width) {
method numeric (line 25) | public static boolean numeric(Type type) {
method max (line 29) | public static Type max(Type type1, Type type2) {
Condensed preview — 45 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (105K chars).
[
{
"path": ".idea/inspectionProfiles/Project_Default.xml",
"chars": 1444,
"preview": "<component name=\"InspectionProjectProfileManager\">\n <profile version=\"1.0\">\n <option name=\"myName\" value=\"Project De"
},
{
"path": ".idea/misc.xml",
"chars": 271,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project version=\"4\">\n <component name=\"ProjectRootManager\" version=\"2\" language"
},
{
"path": ".idea/modules.xml",
"chars": 266,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project version=\"4\">\n <component name=\"ProjectModuleManager\">\n <modules>\n "
},
{
"path": ".idea/uiDesigner.xml",
"chars": 8792,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project version=\"4\">\n <component name=\"Palette2\">\n <group name=\"Swing\">\n "
},
{
"path": ".idea/vcs.xml",
"chars": 167,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project version=\"4\">\n <component name=\"VcsDirectoryMappings\">\n <mapping dire"
},
{
"path": ".idea/workspace.xml",
"chars": 39726,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project version=\"4\">\n <component name=\"ChangeListManager\">\n <list default=\"t"
},
{
"path": "LICENSE",
"chars": 1059,
"preview": "MIT License\n\nCopyright (c) 2018 李欣\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this"
},
{
"path": "LiXinCompiler.iml",
"chars": 423,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<module type=\"JAVA_MODULE\" version=\"4\">\n <component name=\"NewModuleRootManager\" "
},
{
"path": "README.md",
"chars": 4472,
"preview": "# LiXinCompiler\nReferenced from the dragon-book, just a little implementation of the dragon-book language.\n\n参考自龙书上的语言,自己"
},
{
"path": "src/com/lixin/interpreter/Access.java",
"chars": 864,
"preview": "package com.lixin.interpreter;\n\nimport com.lixin.lexer.Tag;\nimport com.lixin.lexer.Word;\nimport com.lixin.symbols.Type;\n"
},
{
"path": "src/com/lixin/interpreter/And.java",
"chars": 551,
"preview": "package com.lixin.interpreter;\n\nimport com.lixin.lexer.Token;\n\n/**\n * @author lixin\n */\npublic class And extends Logical"
},
{
"path": "src/com/lixin/interpreter/Arithmetic.java",
"chars": 836,
"preview": "package com.lixin.interpreter;\n\nimport com.lixin.lexer.Token;\nimport com.lixin.symbols.Type;\n\n/**\n * @author lixin\n */\np"
},
{
"path": "src/com/lixin/interpreter/Break.java",
"chars": 414,
"preview": "package com.lixin.interpreter;\n\n/**\n * @author lixin\n */\npublic class Break extends Statement {\n private Statement st"
},
{
"path": "src/com/lixin/interpreter/Constant.java",
"chars": 797,
"preview": "package com.lixin.interpreter;\n\nimport com.lixin.lexer.Numeric;\nimport com.lixin.lexer.Token;\nimport com.lixin.lexer.Wor"
},
{
"path": "src/com/lixin/interpreter/Do.java",
"chars": 833,
"preview": "package com.lixin.interpreter;\n\nimport com.lixin.symbols.Type;\n\n/**\n * @author lixin\n */\npublic class Do extends Stateme"
},
{
"path": "src/com/lixin/interpreter/Else.java",
"chars": 897,
"preview": "package com.lixin.interpreter;\n\nimport com.lixin.symbols.Type;\n\n/**\n * @author lixin\n */\npublic class Else extends State"
},
{
"path": "src/com/lixin/interpreter/Expression.java",
"chars": 1062,
"preview": "package com.lixin.interpreter;\n\nimport com.lixin.lexer.Token;\nimport com.lixin.symbols.Type;\n\n/**\n * @author lixin\n */\np"
},
{
"path": "src/com/lixin/interpreter/Identifier.java",
"chars": 323,
"preview": "package com.lixin.interpreter;\n\nimport com.lixin.lexer.Word;\nimport com.lixin.symbols.Type;\n\n/**\n * @author lixin\n */\npu"
},
{
"path": "src/com/lixin/interpreter/If.java",
"chars": 681,
"preview": "package com.lixin.interpreter;\n\nimport com.lixin.symbols.Type;\n\n/**\n * @author lixin\n */\npublic class If extends Stateme"
},
{
"path": "src/com/lixin/interpreter/Logical.java",
"chars": 1193,
"preview": "package com.lixin.interpreter;\n\nimport com.lixin.lexer.Token;\nimport com.lixin.symbols.Type;\n\n/**\n * @author lixin\n */\np"
},
{
"path": "src/com/lixin/interpreter/Node.java",
"chars": 558,
"preview": "package com.lixin.interpreter;\n\nimport com.lixin.lexer.Lexer;\n\n/**\n * @author lixin\n */\npublic class Node {\n private "
},
{
"path": "src/com/lixin/interpreter/Not.java",
"chars": 476,
"preview": "package com.lixin.interpreter;\n\nimport com.lixin.lexer.Token;\n\n/**\n * @author lixin\n */\npublic class Not extends Logical"
},
{
"path": "src/com/lixin/interpreter/Operator.java",
"chars": 455,
"preview": "package com.lixin.interpreter;\n\nimport com.lixin.lexer.Token;\nimport com.lixin.symbols.Type;\n\n/**\n * @author lixin\n */\np"
},
{
"path": "src/com/lixin/interpreter/Or.java",
"chars": 546,
"preview": "package com.lixin.interpreter;\n\nimport com.lixin.lexer.Token;\n\n/**\n * @author lixin\n */\npublic class Or extends Logical "
},
{
"path": "src/com/lixin/interpreter/Relation.java",
"chars": 1064,
"preview": "package com.lixin.interpreter;\n\nimport com.lixin.lexer.Token;\nimport com.lixin.symbols.Array;\nimport com.lixin.symbols.T"
},
{
"path": "src/com/lixin/interpreter/Sequence.java",
"chars": 764,
"preview": "package com.lixin.interpreter;\n\n/**\n * @author lixin\n */\npublic class Sequence extends Statement {\n private Statement"
},
{
"path": "src/com/lixin/interpreter/Set.java",
"chars": 1003,
"preview": "package com.lixin.interpreter;\n\nimport com.lixin.symbols.Type;\n\n/**\n * @author lixin\n */\npublic class Set extends Statem"
},
{
"path": "src/com/lixin/interpreter/SetElem.java",
"chars": 1309,
"preview": "package com.lixin.interpreter;\n\nimport com.lixin.symbols.Array;\nimport com.lixin.symbols.Type;\n\n/**\n * @author lixin\n */"
},
{
"path": "src/com/lixin/interpreter/Statement.java",
"chars": 464,
"preview": "package com.lixin.interpreter;\n\n/**\n * @author lixin\n */\npublic class Statement extends Node {\n public Statement() {\n"
},
{
"path": "src/com/lixin/interpreter/Temp.java",
"chars": 385,
"preview": "package com.lixin.interpreter;\n\nimport com.lixin.lexer.Word;\nimport com.lixin.symbols.Type;\n\n/**\n * @author lixin\n */\npu"
},
{
"path": "src/com/lixin/interpreter/Unary.java",
"chars": 675,
"preview": "package com.lixin.interpreter;\n\nimport com.lixin.lexer.Token;\nimport com.lixin.symbols.Type;\n\n/**\n * @author lixin\n */\np"
},
{
"path": "src/com/lixin/interpreter/While.java",
"chars": 803,
"preview": "package com.lixin.interpreter;\n\nimport com.lixin.symbols.Type;\n\n/**\n * @author lixin\n */\npublic class While extends Stat"
},
{
"path": "src/com/lixin/lexer/Lexer.java",
"chars": 4153,
"preview": "package com.lixin.lexer;\n\nimport com.lixin.symbols.Type;\n\nimport java.io.IOException;\nimport java.util.Hashtable;\n\n/**\n "
},
{
"path": "src/com/lixin/lexer/Numeric.java",
"chars": 299,
"preview": "package com.lixin.lexer;\n\n/**\n * @author lixin\n */\npublic class Numeric extends Token {\n public final int value;\n\n "
},
{
"path": "src/com/lixin/lexer/Real.java",
"chars": 299,
"preview": "package com.lixin.lexer;\n\n/**\n * @author lixin\n */\npublic class Real extends Token {\n private final float value;\n\n "
},
{
"path": "src/com/lixin/lexer/Tag.java",
"chars": 605,
"preview": "package com.lixin.lexer;\n\n/**\n * @author lixin\n */\npublic class Tag {\n public final static int\n AND = 256,"
},
{
"path": "src/com/lixin/lexer/Token.java",
"chars": 254,
"preview": "package com.lixin.lexer;\n\n/**\n * @author lixin\n */\npublic class Token {\n public final int tag;\n\n public Token(int "
},
{
"path": "src/com/lixin/lexer/Word.java",
"chars": 803,
"preview": "package com.lixin.lexer;\n\n/**\n * @author lixin\n */\npublic class Word extends Token {\n String lexeme;\n\n public Word"
},
{
"path": "src/com/lixin/main/Compiler.java",
"chars": 1813,
"preview": "package com.lixin.main;\n\nimport com.lixin.lexer.Lexer;\nimport com.lixin.parser.Parser;\n\nimport java.io.*;\n\n/**\n * @autho"
},
{
"path": "src/com/lixin/main/CompilerTestDriver.java",
"chars": 932,
"preview": "package com.lixin.main;\n\nimport java.io.File;\n\n/**\n * @author lixin\n */\npublic class CompilerTestDriver {\n public sta"
},
{
"path": "src/com/lixin/main/Main.java",
"chars": 402,
"preview": "package com.lixin.main;\n\nimport com.lixin.lexer.Lexer;\nimport com.lixin.parser.Parser;\n\nimport java.io.IOException;\n\n/**"
},
{
"path": "src/com/lixin/parser/Parser.java",
"chars": 9806,
"preview": "package com.lixin.parser;\n\nimport com.lixin.interpreter.*;\nimport com.lixin.lexer.*;\nimport com.lixin.symbols.Array;\nimp"
},
{
"path": "src/com/lixin/symbols/Array.java",
"chars": 404,
"preview": "package com.lixin.symbols;\n\nimport com.lixin.lexer.Tag;\n\n/**\n * @author lixin\n */\npublic class Array extends Type {\n "
},
{
"path": "src/com/lixin/symbols/Environment.java",
"chars": 844,
"preview": "package com.lixin.symbols;\n\nimport com.lixin.interpreter.Identifier;\nimport com.lixin.lexer.Token;\n\nimport java.util.Has"
},
{
"path": "src/com/lixin/symbols/Type.java",
"chars": 1241,
"preview": "package com.lixin.symbols;\n\nimport com.lixin.lexer.Tag;\nimport com.lixin.lexer.Word;\n\nimport java.util.Arrays;\n\n/**\n * @"
}
]
About this extraction
This page contains the full source code of the Great-Li-Xin/LiXinCompiler GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 45 files (93.2 KB), approximately 24.7k tokens, and a symbol index with 147 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.