-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: remove symbol type and initial cast
- Loading branch information
Eddie
authored and
Eddie
committed
Jun 17, 2024
1 parent
eb5621e
commit 24990b2
Showing
25 changed files
with
285 additions
and
149 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 |
---|---|---|
@@ -0,0 +1,43 @@ | ||
Types | ||
===== | ||
|
||
| Name | Java Name | Min | Max | | ||
|-----------|-----------|-----------|----------| | ||
| `boolean` | `boolean` | `false` | `true` | | ||
| `unicode` | `char` | `0` | `2^16-1` | | ||
| `i8` | `byte` | `-128` | `127` | | ||
| `i16` | `short` | `-2^15` | `2^15-1` | | ||
| `i32` | `int` | `-2^31` | `2^31-1` | | ||
| `i64` | `long` | `-2^63` | `2^63-1` | | ||
| `f32` | `float` | | | | ||
| `f64` | `double` | | | | ||
|
||
## Implicit Conversion | ||
|
||
- All integer and floating-point operations will preserve accuracy by converting to the largest precision type | ||
|
||
``` | ||
x = 123 # i32 (default integer) | ||
y = x + 0.0 # f32 (default float) implicit cast | ||
``` | ||
|
||
## Explicit Conversion | ||
|
||
- To limit precision, use explicit casting, for example: | ||
- Casting from floating-point to integer | ||
- Casting from i32 to i8 | ||
|
||
Syntax Idea: | ||
|
||
``` | ||
x = 123 # i32 (default integer) | ||
y = i8(x) # i8 decrease precision | ||
z = f64(x) # f64 increase precision | ||
``` | ||
|
||
Unicode Idea: | ||
|
||
``` | ||
i = ordinal('0') # return index of the unicode | ||
u = unicode(48) # return unicode value of numeric | ||
``` |
Binary file not shown.
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,5 +1,5 @@ | ||
SEQUENCE | ||
LITERAL_STRING Hello, World!\n | ||
LITERAL_STRING Hello, World!\n | ||
; | ||
; | ||
; |
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 |
---|---|---|
|
@@ -2,6 +2,7 @@ i = 3 | |
loop (greaterThan i 0) { | ||
print(i) | ||
print('\n') | ||
sleep 1000 | ||
i = - i 1 | ||
} | ||
print("Blast off!\n") |
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
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
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
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.jungle.common; | ||
|
||
import org.apache.commons.lang3.StringEscapeUtils; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
public class StringUtils { | ||
@NotNull | ||
public static String unescapeString(@NotNull String s) { | ||
return StringEscapeUtils.unescapeJava(s); | ||
} | ||
} |
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
25 changes: 0 additions & 25 deletions
25
src/main/java/com/jungle/compiler/operand/OperandStackType.java
This file was deleted.
Oops, something went wrong.
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
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
Oops, something went wrong.