-
大小: 172KB文件類型: .rar金幣: 2下載: 0 次發(fā)布日期: 2021-06-13
- 語言: JavaScript
- 標簽: java??腳本??解釋器??
資源簡介
這是我用java制作的一個腳本語言解釋器,這種腳本語言不是現(xiàn)存的腳本語言,類似Ruby結構。這也是一種完全面向對象的語言。支持操作java對象,但是沒有javaScript那么簡單。因為這里的基本數(shù)據(jù)類型也是通過自己定義的,系統(tǒng)除了定義真假為java中的Boolean外的其他的數(shù)據(jù)類型都要通過,基本語言文件,也就是這里的類文件。目前為測試版本,正在收集Bug。希望大家?guī)臀覝y試一下,聯(lián)系我 QQ:495904500 。希望共同探討的也可以加我。

代碼片段和文件信息
import?java.io.File;
import?java.util.Scanner;
import?com.sapp.main.SappEngine;
public?class?Sapp?{
/**
?*?@param?args
?*?@throws?Exception?
?*/
public?static?void?main(String?[]args){
SappEngine?re?=?new?SappEngine();
try?{
//設置默認的本地class路徑。
re.setNativeClassPath(“res/native“);
//加載語言簡表。
re.load(“res/lang/SappBasicConfigration.sph“);
//加載語言文件
re.load(“res/Test/Hash/hash1.sph“);
//Tools.printVector(re.commnds);
re.exeBegin();
}?catch?(Exception?e)?{
e.printStackTrace();
}
/*Scanner?input?=?new?Scanner(System.in);?
SappEngine?re?=?new?SappEngine();
//設置默認的本地class路徑。
re.setNativeClassPath(“res/native“);
//加載語言簡表。
try?{
//re.setCompCodePath(“res/complied“);
re.load(“res/lang/SappBasicConfigration.sph“);
}?catch?(Exception?e1)?{
System.out.println(“加載語言簡表文件失敗!“);
e1.printStackTrace();
}
while(true){
System.out.println(“請輸入要執(zhí)行的操作:lf-加載文件ri-進入交互界面et-退出程序“);
String?str?=?input.nextLine().trim();
if(str.equals(“l(fā)f“)){
System.out.println(“請輸入要加載的文件(路徑):這個命令先清空Sapp中的begin集合。“);
str?=?input.nextLine().trim();
File?file?=?new?File(str);
if(!file.exists()){
System.out.println(“對不起文件不存在!“);
System.out.print(“按回車鍵繼續(xù)...“);
input.nextLine();
}else{
try?{
//清空begin
re.clearBegin();
//加載文件
re.load(str);
//執(zhí)行begin
re.exeBegin();
System.out.print(“按回車鍵繼續(xù)...“);
input.nextLine();
}?catch?(Exception?e)?{
e.printStackTrace();
System.out.print(“按回車鍵繼續(xù)...“);
input.nextLine();
}
}
}else?if(str.equals(“ri“)){
StringBuffer?cjml?=?new?StringBuffer();
System.out.println(“進入了交互模式:任意輸入為串接當前命令(如果以-c?開頭的為立即執(zhí)行)exe-執(zhí)行串接“?+
“好的命令(會清空此命令)cr-清除串接好的命令et-退出交互模式“);
while(true){
System.out.print(“>“);
str?=?input.nextLine().trim();
if(str.equals(“exe“)){
try?{
re.exeCode(cjml+““);
System.out.println();
cjml?=?new?StringBuffer();
}?catch?(Exception?e)?{
e.printStackTrace();
}
}else?if(str.equals(“cr“)){
cjml?=?new?StringBuffer();
}else?if(str.equals(“et“)){
break;
}else{
if(str.startsWith(“-c“)){
if(str.length()>2){
str?=?str.substring(2).trim();
try?{
re.exeCode(str);
System.out.println();
}?catch?(Exception?e)?{
e.printStackTrace();
}
}else{
System.out.println(“無效的命令:“+str);
}
}else{
cjml.append(str);
}
}
}
}else?if(str.equals(“et“)){
break;
}else{
System.out.println(“未知的命令!“);
}
}*/
}
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????910??2011-09-08?13:19??Sapphire1.21測試版\com\sapp\complie\AnalysedTree$Analysed.class
?????文件??????13367??2011-09-08?13:19??Sapphire1.21測試版\com\sapp\complie\AnalysedTree.class
?????文件???????3907??2011-09-08?13:19??Sapphire1.21測試版\com\sapp\complie\Codedivide.class
?????文件??????10372??2011-09-08?13:19??Sapphire1.21測試版\com\sapp\complie\Complies.class
?????文件???????3908??2011-08-13?17:17??Sapphire1.21測試版\com\sapp\engine\Codedivide.class
?????文件??????26160??2011-08-13?17:17??Sapphire1.21測試版\com\sapp\engine\ComplieCmds.class
?????文件???????2022??2011-09-01?18:58??Sapphire1.21測試版\com\sapp\engine\DivideClass.class
?????文件??????23324??2011-09-01?18:15??Sapphire1.21測試版\com\sapp\engine\Interpreter.class
?????文件????????475??2011-08-19?17:42??Sapphire1.21測試版\com\sapp\engine\ParamsInterface.class
?????文件????????444??2011-08-08?22:47??Sapphire1.21測試版\com\sapp\engine\RunStateException.class
?????文件???????7687??2011-09-01?18:58??Sapphire1.21測試版\com\sapp\engine\SappClass.class
?????文件??????14909??2011-09-01?18:58??Sapphire1.21測試版\com\sapp\engine\SapphireEngine.class
?????文件???????5869??2011-08-09?22:07??Sapphire1.21測試版\com\sapp\engine\SappMethod.class
?????文件??????21529??2011-09-08?14:48??Sapphire1.21測試版\com\sapp\interpreter\Interpreter.class
?????文件????????454??2011-09-08?13:19??Sapphire1.21測試版\com\sapp\interpreter\RunStateException.class
?????文件????????505??2011-09-08?13:46??Sapphire1.21測試版\com\sapp\main\ParamsInterface.class
?????文件???????3382??2011-09-07?20:24??Sapphire1.21測試版\com\sapp\main\Sapp.class
?????文件???????2221??2011-09-08?14:48??Sapphire1.21測試版\com\sapp\main\SappClass$DivideClass.class
?????文件???????6295??2011-09-08?14:48??Sapphire1.21測試版\com\sapp\main\SappClass.class
?????文件???????1406??2011-09-08?14:48??Sapphire1.21測試版\com\sapp\main\SappEngine$ClassMess.class
?????文件??????13363??2011-09-08?14:48??Sapphire1.21測試版\com\sapp\main\SappEngine.class
?????文件???????6539??2011-09-08?14:35??Sapphire1.21測試版\com\sapp\main\SappMethod.class
?????文件???????3770??2011-09-08?13:19??Sapphire1.21測試版\com\sapp\tools\CompliesTools.class
?????文件???????2200??2011-09-08?13:19??Sapphire1.21測試版\com\sapp\tools\EngineTools.class
?????文件???????2119??2011-09-08?13:19??Sapphire1.21測試版\com\sapp\tools\InterpreterTools.class
?????文件????????785??2011-09-08?13:19??Sapphire1.21測試版\com\sapp\tools\SappClassLoader.class
?????文件???????9582??2011-08-08?22:47??Sapphire1.21測試版\com\sapp\tools\Tools.class
?????文件???????1345??2011-09-07?20:06??Sapphire1.21測試版\res\lang\SappArray.sph
?????文件????????499??2011-09-07?12:31??Sapphire1.21測試版\res\lang\SappBasicConfigration.sph
?????文件???????1189??2011-09-07?16:41??Sapphire1.21測試版\res\lang\SappBoolean.sph
............此處省略90個文件信息
評論
共有 條評論