91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 7KB
    文件類型: .zip
    金幣: 2
    下載: 1 次
    發(fā)布日期: 2021-10-08
  • 語言: Java
  • 標(biāo)簽: jav????

資源簡介

詞法分析器可以對C語言進(jìn)行詞法分析,且用java寫的界面

資源截圖

代碼片段和文件信息

package?bianyi;

import?java.awt.Font;
import?java.awt.event.ActionEvent;
import?java.awt.event.ActionListener;
import?java.awt.event.WindowAdapter;
import?java.awt.event.WindowEvent;

import?javax.swing.JButton;
import?javax.swing.Jframe;
import?javax.swing.JTextArea;
import?javax.swing.JLabel;
import?javax.swing.JScrollPane;
??
public?class?init?extends?Jframe?implements?ActionListener
{
????private?JTextArea?input?=?new?JTextArea();
????private?JScrollPane?jsp=new?JScrollPane(input);
????private?JTextArea?text=new?JTextArea();
????private?JScrollPane?jsp2=new?JScrollPane(text);
????private?JLabel?label=new?JLabel(“詞法分析“);
????private?JButton?button?=?new?JButton(“確定“);
????private?JButton?b2=new?JButton(“重置“);
??
????public?init()
????{
????????super(“一個(gè)測試框框“);
??
????????jsp.setBounds(40?100300?500);?
????????jsp2.setBounds(400?100300?500);
????????label.setBounds(3002020050);
????????button.setBounds(200?650?100?30);
????????b2.setBounds(400?650?100?30);
????????
??????//創(chuàng)建Font對象?使用Serief字體,顯示風(fēng)格為斜體Font.ITALIC,加粗Font.BOLD,字號大小為28
????????Font?fnt?=?new?Font(“Serief“?Font.ITALIC?+?Font.BOLD?30);
????????label.setFont(fnt);???????????????????//設(shè)置標(biāo)簽中的字體

????????this.setLayout(null);
????????this.setBounds(800?800?800?800);

????????this.add(jsp);
????????this.add(jsp2);
????????this.add(label);
????????this.add(button);
????????this.add(b2);
??
????????this.addWindowListener(new?WindowAdapter()
????????{
????????????public?void?windowClosing(WindowEvent?e)
????????????{
????????????????System.exit(-1);
????????????}
????????});
??
????????button.addActionListener(this);
????????b2.addActionListener(this);
????????this.setVisible(true);
????}
????
????private?String?keyWord[]?=?{“auto““break““case““char““const““continue“
???? “default““do““double““else““enum““extern““float““for““goto“
???? “if““int““l(fā)ong““register““return““short““signed““sizeof““static“
???? “struct““switch““typedef““union““unsigned““void““volatile““while“};
????//判斷是否是關(guān)鍵字
????boolean?isKey(String?str)
????{
????????for(int?i?=?0;i?????????{
????????????if(keyWord[i].equals(str))
????????????????return?true;
????????}
????????return?false;
????}
????//判斷是否是字母
????boolean?isLetter(char?letter)
????{
????????if((letter?>=?‘a(chǎn)‘?&&?letter?<=?‘z‘)||(letter?>=?‘A‘?&&?letter?<=?‘Z‘))
????????????return?true;
????????else
????????????return?false;
????}
????//判斷是否是數(shù)字
????boolean?isDigit(char?digit)
????{
????????if(digit?>=?‘0‘?&&?digit?<=?‘9‘)
????????????return?true;
????????else
????????????return?false;
????}
????
????private?char?ch;
????void?analyze(char[]?chars)
????{
????????String?arr?=?““;
????????
????????for(int?i?=?0;i????????????ch?=?chars[i];
????????????arr?=?““;
????????????if(ch?==?‘?‘||ch?==?‘\t‘||ch?==?‘\n‘||ch?==?‘\r‘){}
????????????else?if(isLetter(ch)){
???????????????

?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????文件?????????301??2018-11-25?19:04??bianyi\.classpath
?????文件?????????382??2018-11-25?19:04??bianyi\.project
?????文件?????????598??2018-11-25?19:04??bianyi\.settings\org.eclipse.jdt.core.prefs
?????文件?????????620??2018-11-25?22:02??bianyi\bin\bianyi\init$1.class
?????文件????????5658??2018-11-25?22:02??bianyi\bin\bianyi\init.class
?????文件????????6822??2018-11-25?22:02??bianyi\src\bianyi\init.java

評論

共有 條評論