Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ Open-source Implementation of the Java language in TypeScript. (<https://docs.or
- [Table of Contents](#table-of-contents)
- [Prerequisites](#prerequisites)
- [Usage](#usage)
- [Current Features](#current-features)
- [Future Features](#future-features)
- [Testing](#testing)
- [Using your java-slang in Source Academy](#using-your-java-slang-in-source-academy)
- [Using your java-slang in your local Source Academy](#using-your-java-slang-in-your-local-source-academy)
Expand Down Expand Up @@ -39,6 +41,26 @@ $ git submodule update --init --recursive
$ git submodule update --recursive --remote
```

## Current Features

The Java language in Source Academy currently supports a host of available features, including:

- Primitive classes: boolean, byte, short, int, long, char, float and double.
- Custom (non-primitive) classes
- Method overloading
- Implicit type widening for both primitive and non-primitive types (e.g. int to long)
- Basic exception/error messages
- Basic system calls e.g. System.out.println
- Single nested class

## Future Features

- Multiple class declarations in the same file
- Inheritance (basis for implementation exists but requires multiclass declaration to function)
- Explicit type conversion (type narrowing)
- Implicit type conversion for system calls (e.g. int input to System.out.println)
- Generics
- Multi-file programs

## Testing

Expand Down
7 changes: 7 additions & 0 deletions src/compiler/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
This is a bookkeeping of the planned scope of the compiler. It will be updated from time to time to reflect the current status of the compiler and to make the scope clearer. For a more formal treatment of what features are being supported, see scope.txt for a BNF-form of the Java sub-language.

Note that the compiler is separate from the Java Playground in Source Academy, which runs in tandem with the ECE. As such, any program run in the Playground will follow the features implemented in the ECE (e.g. widening type conversions), rather than the features below.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The compiler+typecheck->JVM toolchain is the default execution in js-slang. The CSEC machine doesn't need to be mentioned here. It is an additional optional visualization tool.


**Features that are already supported**

- Single source file, single public class, with exactly one main method
Expand Down Expand Up @@ -30,3 +32,8 @@ This is a bookkeeping of the planned scope of the compiler. It will be updated f
- Generics
- Type casting

**Testing**
Unit tests are located in the "__tests__/tests" folder. The main testing file is "__tests__/index.ts", in which the tests to be run can be specified. To run, navigate to the main java-slang folder and run:
```bash
$ yarn test src/compiler/__tests__/index.ts
```
Loading