⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 test.java

📁 java compiler project to implement LR parsing
💻 JAVA
字号:
/*******************************************************************************
 * Test. 
 * New language which is called BASCAL.
 * Date : 20/9/2006,Time : 2:41.
 ******************************************************************************/
import mk.ceit.Compiler;

import java.io.File;
import java.io.IOException;
import java.util.Scanner;

public class Test
{
	public static void main(String[]args)
	{
		Compiler c;
		Scanner in;
		boolean complete=true;
		String nameOfFile="";
		
		in=new Scanner(System.in);

		while(complete)
		{
			try
			{
				System.out.println("Enter the name of file that you want to compile.\n");
				nameOfFile=in.nextLine();
				/*******************************************************************
				 *This constructor is used for connect to compiler program.
				 *You can input as data in constructor either File or simple String.
				 *Ex: as follow:
				 *Compiler compiler=new Compiler(new File(nameOfFile.txt));
				 *other Example using String as input,
				 *code="THE CODE MUST BE WRITTEN HERE..",
				 *Compiler compiler=new Compiler(code);
				 ******************************************************************/
				
				c=new Compiler(new File(nameOfFile+".BC"));
				
				System.out.print("\n\n*************   COMPILATION   *************\n\n");
				c.compile();
				System.out.println(c.getFinalMessage());
				complete=false;
			}
			catch(IOException e)
			{
				if(nameOfFile.equalsIgnoreCase("stop"))
				complete=false;
				else
				System.out.println("Error opening file.\n");
			}
		}
		
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -