Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Kevin
committed
Sep 5, 2018
1 parent
c9b1fd1
commit 9effaca
Showing
1 changed file
with
49 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,57 @@ | ||
Enkel (JVM based language) | ||
======= | ||
|
||
This repo is just practice code base of [Creating JVM language](http://jakubdziworski.github.io/enkel/2016/03/10/enkel_first.html), the original repo is [here](https://github.com/JakubDziworski/Enkel-JVM-language), | ||
Enkel is a simple programming language running on the jvm | ||
|
||
which based on maven, this repo has changed to gradle. | ||
|
||
## Build & Run | ||
- Generate parser code from ANTLR | ||
`./gradlew :antlr:generateGrammarSource ` | ||
|
||
- Compile `*.enk` to `*.class` | ||
Using IDEA | ||
|
||
- Run | ||
`java *.class` | ||
|
||
## Example | ||
|
||
- Input(`Fields.enl`) | ||
``` | ||
Fields { | ||
int field | ||
start { | ||
field = 5 | ||
print field | ||
} | ||
} | ||
``` | ||
|
||
- Output(`Fields.class`) | ||
|
||
Decompiled form: | ||
``` | ||
public class Fields { | ||
public int field; | ||
public void start() { | ||
this.field = 5; | ||
System.out.println(this.field); | ||
} | ||
public Fields() { | ||
} | ||
public static void main(String[] var0) { | ||
(new Fields()).start(); | ||
} | ||
} | ||
``` | ||
|
||
Other examples please see `./EnkelExamples/*.enk` | ||
|
||
## TODO | ||
- [ ] Other grammar feature | ||
- [ ] IDEA highlight plugin | ||
- [ ] Support debugger | ||
- [ ] Port to LLVM IR |