資源簡介
編譯原理課程設計——實現(xiàn)簡單的四則元算,包括詞法分析、語法分析、語義分析

代碼片段和文件信息
package?com.panhanchun.simpleParser;
/**
?*?@author?潘漢春
?*?@note?Demonstrate?the?Parser
?*?@date?15/01/2007
?*?
?*/
import?javax.swing.*;
import?java.awt.*;??????????????//for?layout?managers?and?more
import?java.awt.event.*;????????//for?action?events
@SuppressWarnings(“serial“)
public?class?Demo?extends?JPanel
?????????????????????????????implements?ActionListener?{
????protected?static?final?String?textFieldString?=?“算術表達式“;
????protected?static?final?String?buttonString?=?“JButton“;
????protected?JLabel?actionLabel;
????protected?JTextArea?textArea0;
????protected?JTextArea?textArea1;
????public?Demo()?{
????????setLayout(new?BorderLayout());
???????
????????//Create?a?regular?text?field.
????????JTextField?textField?=?new?JTextField(25);
????????textField.setActionCommand(textFieldString);
????????textField.addActionListener(this);
????????//Create?some?labels?for?the?fields.
????????JLabel?textFieldLabel?=?new?JLabel(textFieldString?+?“:?“);
????????textFieldLabel.setLabelFor(textField);
?????
????????//Create?a?label?to?put?messages?during?an?action?event.
????????actionLabel?=?new?JLabel(“運行結果“);
????????actionLabel.setBorder(BorderFactory.createEmptyBorder(25000));
????????//Lay?out?the?text?controls?and?the?labels.
????????JPanel?textControlsPane?=?new?JPanel();
????????GridBagLayout?gridbag?=?new?GridBagLayout();
????????textControlsPane.setLayout(gridbag);
????????JLabel[]?labels?=?{textFieldLabel};
????????JTextField[]?textFields?=?{textField};
????????addLabelTextRows(labels?textFields?gridbag?textControlsPane);
????????
????????textControlsPane.setBorder(
????????????????BorderFactory.createCompoundBorder(
????????????????????????????????BorderFactory.createtitledBorder(“輸入“)
????????????????????????????????BorderFactory.createEmptyBorder(5555)));
????????
????????//Create?a?text?area.
????????textArea0?=?new?JTextArea(““);
????????JScrollPane?areaScrollPane0?=?new?JScrollPane(textArea0);
????????areaScrollPane0.setVerticalScrollBarPolicy(
????????????????????????JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
????????areaScrollPane0.setPreferredSize(new?Dimension(250?250));
????????areaScrollPane0.setBorder(
????????????BorderFactory.createCompoundBorder(
????????????????BorderFactory.createCompoundBorder(
????????????????????????????????BorderFactory.createtitledBorder(“詞法分析“)
????????????????????????????????BorderFactory.createEmptyBorder(5555))
????????????????areaScrollPane0.getBorder()));
????????
????????//Create?a?text?area.
????????textArea1?=?new?JTextArea(““);
????????JScrollPane?areaScrollPane1?=?new?JScrollPane(textArea1);
????????areaScrollPane1.setVerticalScrollBarPolicy(
????????????????????????JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
????????areaScrollPane1.setPreferredSize(new?Dimension(250?150));
????????areaScrollPane1.setBorder(
????????????BorderFactory.createCompoundBorder(
????????????????BorderFactory.createCompoundBor
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????301??2009-08-07?21:49??simpleParser\.classpath
?????文件????????388??2009-08-07?21:49??simpleParser\.project
?????文件????????629??2009-08-07?21:49??simpleParser\.settings\org.eclipse.jdt.core.prefs
?????文件????????552??2009-09-01?11:12??simpleParser\bin\com\panhanchun\simpleParser\Demo$1.class
?????文件???????5693??2009-09-01?11:12??simpleParser\bin\com\panhanchun\simpleParser\Demo.class
?????文件???????5076??2009-09-01?11:12??simpleParser\bin\com\panhanchun\simpleParser\Parser.class
?????文件????????516??2009-09-01?11:12??simpleParser\bin\com\panhanchun\simpleParser\ParserException.class
?????文件???????6866??2009-08-07?22:02??simpleParser\src\com\panhanchun\simpleParser\Demo.java
?????文件???????7527??2009-08-07?21:51??simpleParser\src\com\panhanchun\simpleParser\Parser.java
?????目錄??????????0??2009-09-01?11:12??simpleParser\bin\com\panhanchun\simpleParser
?????目錄??????????0??2009-08-07?21:50??simpleParser\src\com\panhanchun\simpleParser
?????目錄??????????0??2009-09-01?11:12??simpleParser\bin\com\panhanchun
?????目錄??????????0??2009-08-07?21:50??simpleParser\src\com\panhanchun
?????目錄??????????0??2009-09-01?11:12??simpleParser\bin\com
?????目錄??????????0??2009-08-07?21:50??simpleParser\src\com
?????目錄??????????0??2009-08-07?21:49??simpleParser\.settings
?????目錄??????????0??2009-09-01?11:12??simpleParser\bin
?????目錄??????????0??2009-08-07?21:50??simpleParser\src
?????目錄??????????0??2009-08-07?21:49??simpleParser
-----------?---------??----------?-----??----
????????????????27548????????????????????19
- 上一篇:SPSS實驗報告
- 下一篇:2FSK信號的頻譜分析及解調的實現(xiàn)
評論
共有 條評論