Skip to content

oshimayuki1124/miniJava

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

miniJava

This is a subset of Java. Imprementing its interpreter, I deepen my understanding.

miniJava1

What is to implement

  • declaration
  • substitution
  • single class
  • method with none argument
  • int and boolean value
  • binary operation
  • if statement
  • while statement
  • input from one file
  • simple method calling
  • out is abbreviation of System.out.println
  • type checking before executing

Example

class Test {
	void main() {
		int x;
		x = x + 1;
		out(x);
		if (x == 0) {
			x = x - 2;
		} else if (x == 1) {
			x = x + 1;
		} else if (x == 2) {
			x = x + 3;
		} else {
			x = 100;
		}
		out(x);

		show();

		int y;
		while (y<100) {
			y = y + 1;
		}
		out(y);
	}

	void show() {
		out(3);
		out(true);
		out(2525252);
	}
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published