亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? syntaxanalyizerjava.txt

?? 詞法分析器編譯原理課程設計作業的一個組成部分,用面向對象方法設計
?? TXT
字號:
package testExperiment

//Demonstrate Lex Analyzer
//The purpose of this experiment is to make us familiar with  Lex-like Algorithem
//first let me make a introduction:
//This Analyzer is programmed by Java languange
//By useing 11 methods (including main method) ,it is concise and easy for reading

import java.io.*;
import java.util.StringTokenizer;

//Class name
public class Compiler_Simulate_Lex 
{   
	//Main method
	public static void main(String[] args)
	{
		//Set a counter
		int counter = 0;
		
        //It has 98 keywords
		String[] Keyword = {
"absolute","end","inline","procedure","type","and","external","interface","program","unit","array","file","interrupt","record","until","begin","for","label","repeat","uses","case","forward","mod","set","var","const","function","nil","shl","while","div","goto","not","shr","with","do","if","of","string","xor","downto","implementation","in","then","else","or","packed","to","ABSOLUTE","END","INLINE","PROCEDURE","TYPE","AND","EXTERNAL","INTERFACE","PROGRAM","UNIT","ARRAY","FILE","INTERRUPT","RECORD","UNTIL","BEGIN","FOR","LABEL","REPEAT","USES","CASE","FORWARD","MOD","SET","VAR","CONST","FUNCTION","NIL","SHL","WHILE","DIV","GOTO","NOT","SHR","WITH","DO","IF","OF","STRING","XOR","DOWNTO","IMPLEMENTATION","IN","THEN","ELSE","OR","PACKED","TO","WRITE","write"
				};
		
		//It has 52 alphabetas
		String Alphabeta = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
		
		//It has 10 numbers in all
		String Digit = "0123456789";
		
		//It has 13 identities
		String Identity = "\"\'\\<=>:+-();/";
		
		//Give a pascal program as a test
		//The total number of words is 96
		String TestPascalProgram = "program tripme ( input , output ) ; " +
				"var " +
				"x , y , c : integer ; " +
				"function add ( int a , int b ) : int " +
				"begin add = a + b ; end ; " +
				"function subtract ( int a , int b ) : int " +
				"begin subtract = a - b ; end ; " +
				"begin x = 6 ; y = 2 ; c := subtract ( a , b ) ; " +
				"write ( c ) ; c := add ( a , b ) ; " +
				"write ( c ) ; end .";
		
		
	    //show the TestProgram
		System.out.println("Here is a Pascal program for testing the Lex analyzer:");
		System.out.println("***********************************************************");
		System.out.println("program tripme (input , output);");
		System.out.println("var ");
		System.out.println("x , y , c : integer ; ");
		System.out.println("function add (int a , int b) : int ");
		System.out.println("begin add = a + b ; end ; ");
		System.out.println("function subtract (int a , int b) : int ");
		System.out.println("begin subtract = a - b ; end ; ");
		System.out.println("begin x = 6 ; y = 2 ; c := subtract (a , b) ; ");
		System.out.println("write (c) ; c := add (a , b) ; " );
		System.out.println("write (c) ; end .");
		
		
//Remind that the analyze begins.
		System.out.println("***********************************************************");
		System.out.println("");
		System.out.println("Now begin analyzing:");
		System.out.println('\r');

		//Create String[] to store TestProgram
		String[] Tokens = (String[])tokenIntoArray(TestPascalProgram).clone();
		
		//Use loop to identify program
		for(counter = 0;counter <= numberOfTokens(TestPascalProgram);counter++)
		{
			//first check whether it is a keyword and then print the result out
			System.out.print(Tokens[counter]);
			
			if(isKeyword(Tokens[counter],Keyword))
					{
				        System.out.println('\b'+": Is a keyword"+"and is located at"+
						locateKeyword(Tokens[counter],Keyword));
					}
			
			//Then Check whether it is a Alphabeta
			else if(isAlphabeta(Tokens[counter],Alphabeta))
			           {
				    
				//The process below is worthless,should be deleted
				if(locateAlphabeta(Tokens[counter],Alphabeta) > 0)
				              { 
					           System.out.print('\b'+": Is a Alphabeta"+"and is located at"
				               +locateAlphabeta(Tokens[counter],Alphabeta)+95);
				              }
				    else{}
				   
			           }
			
			//And then check whether it is a Digit
			else if(isDigit(Tokens[counter],Digit))
			{
				System.out.println('\b'+": Is a digit"+"and is located at"+
						locateDigit(Tokens[counter],Digit)+95+52);
			}
			
			//Finally check whether it is a Identity
			else if(isIdentity(Tokens[counter],Identity))
			{
				System.out.println('\b'+": Is a identity and is located at"+
						locateIdentity(Tokens[counter],Identity)+95+52+10);
			}
		}
		
		System.out.println("Analysis completed successfully");
	}
	
	//Give a method to create a way,analyzing the Array of Tokens 
	//that whether it is a keyword
	public static boolean isKeyword(String Token, String[] keyword)
	{
		int i = 0;
		while(keyword[i] != Token)
		{
			i=i+1;
		}
		if(i>97) return false;
		else return true;
	}
	
	//A method to analyze Tokens wheteher it is a Alphabeta.
	public static boolean isAlphabeta(String Token, String alphabeta)
	{
		int i = 0;
		while(Token.charAt(0) != alphabeta.charAt(i))
		{
			i++;
		}
	
		if(i>51) return false;
		else return true;
	}
	
    //A method to analyze Tokens wheteher it is a digit.
	public static boolean isDigit(String Token, String digit)
	{
		int i = 0;
		while(Token.charAt(0) != digit.charAt(i))
		{
			i++;
		}
		if(i>9) return false;
		else return true;
	}
	
    //A method to analyze Tokens wheteher it is a identity
	public static boolean isIdentity(String Token, String identity)
	{
		int i = 0;
		while(Token.charAt(0) != identity.charAt(i))
		{
			i++;
		}
		if(i>12) return false;
		else return true;
	}
	
	//Make the testprogram into tokens and then store in an array
	public static String[] tokenIntoArray(String s)
	{
		//make a counter to limit the process of copy
		int counter = 0; 
		
		 //Make an Array to store Tokens.
		String[] Tokens = new String[98];
		
		StringTokenizer Words = new StringTokenizer(s);
		
		//Clone Tokens to Array
		while(Words.hasMoreElements())
		{
			Tokens[counter] = Words.nextToken();
			counter++;
		}
		
		return Tokens;
	}
	
	//Count the number of token
	public static int numberOfTokens(String s)
	{
		StringTokenizer Words = new StringTokenizer(s);
		return Words.countTokens();
	}
	
	//get the number in string
	public static int locateKeyword(String Token, String[] keyword)
	{
		int i = 0;
		while(keyword[i] != Token)
		{
			i++;
		}
		if (i <=95) return i;
		else return -1;
	}
	
	//get the number in string
	public static int locateAlphabeta(String Token, String alphabeta)
	{
		int i = 0;
		while(Token.charAt(0)!= alphabeta.charAt(i))
		{
			i++;
		}
		if(i<=51) return i;
		else return -1;
		
	}
	
	//get the number in string
	public static int locateDigit(String Token, String digit)
	{
		int i = 0;
		while(Token.charAt(0) != digit.charAt(i))
		{
			i++;
		}
		if(i<=9) return i;
		else return -1;
	}
	
	//get the number in string
	public static int locateIdentity(String Token, String identity)
	{
		int i = 0;
		while(Token.charAt(0) != identity.charAt(i))
		{
			i++;
		}
		if(i<=12) return i;
		else return -1;
	}
}
class MyInput 
{
	public static String readString()
	{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in),1);
		String string = " ";
		try
		{
			string = br.readLine();
		}
		catch(IOException ex)
		{
			System.out.println(ex);
		}
		return string;
	}
	
	public static int readInt()
	{
		return Integer.parseInt(readString());
	}
	
	public static double readDouble()
	{
		return Double.parseDouble(readString());
	}

}
?	運行結果:

Here is a Pascal program for testing the Lex analyzer:
***********************************************************
program tripme (input , output);
var 
x , y , c : integer ; 
function add (int a , int b) : int 
begin add = a + b ; end ; 
function subtract (int a , int b) : int 
begin subtract = a - b ; end ; 
begin x = 6 ; y = 2 ; c := subtract (a , b) ; 
write (c) ; c := add (a , b) ; 
write (c) ; end .
***********************************************************

Now begin analyzing:


program : Is a keyword and is located at 1
tripme : Is a Alphabeta and is located at 8
(: Is a identity and is located at 19
input : Is a Alphabeta and is located at 9
, : Is a identity and is located at 20
output : Is a Alphabeta and is located at 10
) : Is a identity and is located at 21
; : Is a identity and is located at22
var : Is a keyword and is located at 2
x : Is a Alphabeta and is located at 11
, : Is a identity and is located at 20
y : Is a Alphabeta and is located at 12
, : Is a identity and is located at 20
c : Is a Alphabeta and is located at 13
: : Is a identity and is located at 23
integer : Is a keyword and is located at 3
; : Is a identity and is located at 22
function : Is a keyword and is located at 4
add : Is a Alphabeta and is located at 14
(: Is a identity and is located at 19
int : Is a Alphabeta and is located at 15
a : Is a Alphabeta and is located at 16
, : Is a identity and is located at 20
int : Is a Alphabeta and is located at 15
b : Is a Alphabeta and is located at 24
) : Is a identity and is located at 21
: : Is a identity and is located at 23
int : Is a Alphabeta and is located 15
begin : Is a keyword and is located at 5
add : Is a Alphabeta and is located at 14
=: Is a identity and is located at 24
a : Is a Alphabeta and is located at 16
+: Is a identity and is located at 25
b : Is a Alphabeta and is located at 17
; : Is a identity and is located at 22
end : Is a keyword and is located at 6
; : Is a identity and is located at 22
function : Is a keyword and is located at 4
subtract : Is a Alphabeta and is located at 18
(: Is a identity and is located at 19
int : Is a Alphabeta and is located at 15
a : Is a Alphabeta and is located at 16
, : Is a identity and is located at 20
int : Is a Alphabeta and is located at 15
b : Is a Alphabeta and is located at 17
) : Is a identity and is located at 21
: : Is a identity and is located at 23
int : Is a Alphabeta and is located at 15
begin : Is a keyword and is located at 5
subtract : Is a Alphabeta and is located at 18
=: Is a identity and is located at 24
a : Is a Alphabeta and is located at 16
-: Is a identity and is located at 25
b : Is a Alphabeta and is located at 17
; : Is a identity and is located at 22
end : Is a keyword and is located at 6
; : Is a identity and is located at 22
begin : Is a keyword and is located at 5
x : Is a Alphabeta and is located at 11
=: Is a identity and is located at 24
6 : Is a digit and is located at 19
; : Is a identity and is located at 22
y : Is a Alphabeta and is located at 12
=: Is a identity and is located at 24
2 : Is a digit and is located at 20
; : Is a identity and is located at 22
c : Is a Alphabeta and is located at 13
:= : Is a identity and is located at 26
subtract : Is a Alphabeta and is located at 18
(: Is a identity and is located at 19
a : Is a Alphabeta and is located at 16
, : Is a identity and is located at 20
b : Is a Alphabeta and is located at 17
) : Is a identity and is located at 21
; : Is a identity and is located at 22
write : Is a keyword and is located at 7
(: Is a identity and is located at 19
c : Is a Alphabeta and is located at 13
) : Is a identity and is located at 21
; : Is a identity and is located at 22
c : Is a Alphabeta and is located at 13
:= : Is a identity and is located at 26
Add : Is a Alphabeta and is located at 14
(: Is a identity and is located at 19
a : Is a Alphabeta and is located at 16
, : Is a identity and is located at 20
b : Is a Alphabeta and is located at 17
) : Is a identity and is located at 21
; : Is a identity and is located at 22
write : Is a keyword and is located at 7
(: Is a identity and is located at 19
c : Is a Alphabeta and is located at 13
) : Is a identity and is located at 21
; : Is a identity and is located at 22
end : Is a keyword and is located at 6
. : Is a identity and is located at 27

Analysis completed successfully

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品福利视频一区二区三区| 一二三四区精品视频| 国产欧美日韩在线观看| 一区二区三区四区不卡在线| 日本成人在线不卡视频| 国产suv精品一区二区6| 欧美日韩免费观看一区三区| 精品1区2区在线观看| 一区二区三区**美女毛片| 精品一区免费av| 色老汉av一区二区三区| 欧美精品一区二区三区高清aⅴ| 中文字幕在线不卡一区 | 男男视频亚洲欧美| 成人动漫中文字幕| 日韩欧美色综合网站| 中文字幕+乱码+中文字幕一区| 久久99这里只有精品| 一本久久a久久精品亚洲| 欧美成人精精品一区二区频| 伊人色综合久久天天人手人婷| 国产一区二区三区四| 欧美日韩国产系列| 亚洲欧洲精品一区二区三区| 极品美女销魂一区二区三区 | 国产精品一二三| 91麻豆精品国产| 一区二区三区久久久| 成人av动漫在线| 欧美大胆一级视频| 日韩二区三区在线观看| 欧美午夜一区二区三区| 亚洲精品中文在线| 成人18视频在线播放| 精品国产乱码久久久久久老虎 | 六月丁香婷婷久久| 7777精品伊人久久久大香线蕉超级流畅 | 国产精品自拍一区| 69精品人人人人| 亚洲6080在线| 欧美人与z0zoxxxx视频| 亚洲mv在线观看| 欧美日韩国产美| 亚洲成人综合视频| 欧美在线一区二区| 亚洲一区二区av在线| 色婷婷综合激情| 亚洲国产日韩在线一区模特| 色8久久人人97超碰香蕉987| 亚洲色图第一区| 色婷婷精品久久二区二区蜜臀av| 中文字幕一区二区在线播放| 成人av电影在线观看| 国产精品久久久久久亚洲毛片| 成人永久免费视频| 自拍偷在线精品自拍偷无码专区| 成人免费福利片| 一区在线中文字幕| 在线观看视频一区二区| 亚洲午夜成aⅴ人片| 7777女厕盗摄久久久| 美女网站色91| 国产欧美日韩在线看| 91麻豆蜜桃一区二区三区| 亚洲黄色片在线观看| 欧美日韩综合色| 久久www免费人成看片高清| 久久久久久综合| 色婷婷亚洲综合| 奇米影视在线99精品| 久久久99精品久久| 一本久道中文字幕精品亚洲嫩| 亚洲成av人影院| 久久伊人中文字幕| 色偷偷一区二区三区| 免费观看日韩av| 国产精品欧美精品| 欧美精品日韩一本| 国产白丝精品91爽爽久久| 亚洲免费在线电影| 精品国产欧美一区二区| www..com久久爱| 欧美aaa在线| 亚洲欧美一区二区三区久本道91| 欧美浪妇xxxx高跟鞋交| 国产精品一区二区黑丝| 亚洲夂夂婷婷色拍ww47| 久久新电视剧免费观看| 在线观看免费亚洲| 精品一区二区三区在线视频| 国产精品二三区| 日韩欧美国产系列| 在线观看国产91| 成人午夜激情在线| 蜜桃视频在线观看一区| 亚洲精品视频在线观看网站| 欧美精品一区二区不卡| 欧美在线高清视频| 99国产精品久久久久久久久久| 日韩成人一级片| 亚洲精品国产a久久久久久| 26uuuu精品一区二区| 欧美精品少妇一区二区三区| www.亚洲激情.com| 狠狠色丁香九九婷婷综合五月| 亚洲图片欧美色图| 亚洲图片另类小说| 亚洲国产成人午夜在线一区| 欧美一区二区三区小说| 在线观看不卡一区| 91在线云播放| eeuss鲁片一区二区三区在线观看 eeuss鲁片一区二区三区在线看 | 精品系列免费在线观看| 亚洲午夜精品网| 亚洲精品高清在线| 国产精品国产自产拍在线| 精品少妇一区二区三区视频免付费 | 日本vs亚洲vs韩国一区三区| 亚洲视频一区二区在线| 久久色中文字幕| 精品国产凹凸成av人网站| 欧美一区二区三区免费视频| 欧洲av一区二区嗯嗯嗯啊| 色悠久久久久综合欧美99| 成人精品小蝌蚪| 成人看片黄a免费看在线| 国产激情视频一区二区在线观看| 美女性感视频久久| 韩国女主播一区| 国产精品一区在线观看乱码| 国内成人精品2018免费看| 精品综合久久久久久8888| 久久99精品国产麻豆婷婷| 寂寞少妇一区二区三区| 国产麻豆91精品| 国产精品99久| av激情综合网| 91麻豆高清视频| 精品1区2区3区| 日韩三级精品电影久久久| 欧美电影免费观看高清完整版在| 精品乱人伦小说| 中文字幕乱码亚洲精品一区| 亚洲人成7777| 亚洲第一福利视频在线| 免费一级片91| 国产91精品久久久久久久网曝门| eeuss鲁片一区二区三区| 在线一区二区三区四区| 9191国产精品| 欧美经典一区二区| 樱花草国产18久久久久| 丝袜a∨在线一区二区三区不卡| 日本中文一区二区三区| 国产精品77777竹菊影视小说| 成人精品国产一区二区4080| 色菇凉天天综合网| 日韩一区二区精品在线观看| 国产日产欧产精品推荐色| 亚洲精品乱码久久久久久久久| 亚洲高清在线视频| 国产精品自在欧美一区| 色天使色偷偷av一区二区| 日韩三级av在线播放| 国产精品乱人伦| 欧美精品777| 成人一级视频在线观看| 成人免费毛片a| 精品视频免费在线| 亚洲精品一区二区三区在线观看| 中文字幕的久久| 三级在线观看一区二区| 国产精品911| 欧美日韩精品免费| 欧美经典三级视频一区二区三区| 亚洲曰韩产成在线| 国产一区二区三区日韩| 欧美曰成人黄网| 欧美国产精品一区| 日本三级韩国三级欧美三级| 成人a免费在线看| 欧美一区二区高清| 一区二区三区四区国产精品| 国产综合久久久久影院| 欧美日韩在线播放| 成人欧美一区二区三区小说| 久国产精品韩国三级视频| 在线观看视频一区二区欧美日韩| 国产午夜亚洲精品午夜鲁丝片| 国产精品久久午夜| 一区二区三区欧美亚洲| 国产一区二区精品久久91| 欧美日韩国产免费一区二区 | 免费看欧美美女黄的网站| 91在线视频在线| 欧美激情一区在线观看| 国内精品国产成人国产三级粉色 | 在线不卡欧美精品一区二区三区| 亚洲欧洲日韩在线| 国产成人av电影免费在线观看|