Compare commits
3 commits
Author | SHA1 | Date | |
---|---|---|---|
9ce7bf5b9d | |||
5e74e8baf7 | |||
93b88a01eb |
4 changed files with 12 additions and 26 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -3,3 +3,6 @@ test*.isbpl
|
|||
*.jar
|
||||
*.bf.isbpl
|
||||
rust-interpreter
|
||||
.idea
|
||||
*.iml
|
||||
out
|
||||
|
|
|
@ -47,13 +47,6 @@ public class ISBPL {
|
|||
HashMap<String, ISBPLCallable> natives = new HashMap<>();
|
||||
boolean stopExceptions = false;
|
||||
HashMap<Throwable, Stack<ISBPLFrame>> stackTraces = new HashMap<>();
|
||||
|
||||
public static void clean() {
|
||||
System.out.println("ISBPL CLEAN!!");
|
||||
defaultTypeInt = new ISBPLType("int", -2);
|
||||
defaultTypeString = new ISBPLType("string", -1);
|
||||
ISBPLStreamer.streams.clear();
|
||||
}
|
||||
|
||||
private final Object syncMakeThread = new Object();
|
||||
private ISBPLKeyword getKeyword(String word) {
|
||||
|
@ -1521,8 +1514,8 @@ public class ISBPL {
|
|||
}
|
||||
|
||||
// These will die as soon as std creates the real types and any types created before these are replaced become invalid.
|
||||
static ISBPLType defaultTypeInt = new ISBPLType("int", -2);
|
||||
static ISBPLType defaultTypeString = new ISBPLType("string", -1);
|
||||
static final ISBPLType defaultTypeInt = new ISBPLType("int", -2);
|
||||
static final ISBPLType defaultTypeString = new ISBPLType("string", -1);
|
||||
|
||||
public ISBPLType getType(String name) {
|
||||
for (int i = 0 ; i < types.size() ; i++) {
|
||||
|
@ -2492,7 +2485,7 @@ class ISBPLFrame {
|
|||
public ISBPL context;
|
||||
public ISBPLFrame parent;
|
||||
public HashMap<String, ISBPLCallable> map = new HashMap<>();
|
||||
public HashMap<Object, ISBPLObject> variables = new HashMap<>();
|
||||
public HashMap<String, ISBPLObject> variables = new HashMap<>();
|
||||
public String name;
|
||||
|
||||
public ISBPLFrame(String name, ISBPL context) {
|
||||
|
@ -2525,10 +2518,9 @@ class ISBPLFrame {
|
|||
}
|
||||
|
||||
public void define(String name, ISBPLObject value) {
|
||||
Object var = new Object();
|
||||
variables.put(var, value);
|
||||
add(name, (stack) -> stack.push(variables.get(var)));
|
||||
add("=" + name, (stack) -> variables.put(var, stack.pop()));
|
||||
variables.put(name, value);
|
||||
add(name, (stack) -> stack.push(variables.get(name)));
|
||||
add("=" + name, (stack) -> variables.put(name, stack.pop()));
|
||||
}
|
||||
|
||||
public HashMap<String, ISBPLCallable> all() {
|
||||
|
@ -2537,3 +2529,5 @@ class ISBPLFrame {
|
|||
return r;
|
||||
}
|
||||
}
|
||||
|
||||
public interface
|
|
@ -3,8 +3,6 @@ Improved Stack-Based Programming Language
|
|||
|
||||
Incomplete, not currently compilable, only interpretable.
|
||||
|
||||
ISBPL is now obsolete. Try [SPL](https://github.com/tudbut/spl) instead.
|
||||
|
||||
Stuff: [TudbuT/isbpl-random-stuff](https://github.com/TudbuT/isbpl-random-stuff)
|
||||
|
||||
---
|
||||
|
@ -20,7 +18,7 @@ is the same as
|
|||
```
|
||||
or
|
||||
```isbpl
|
||||
(((2 1 *) 1 +) print)
|
||||
( ( ( 2 1 * ) 1 + ) print )
|
||||
```
|
||||
in both languages, this will print 3.
|
||||
|
||||
|
|
|
@ -593,12 +593,3 @@ func astartswith {
|
|||
match alen
|
||||
asub match eq
|
||||
}
|
||||
|
||||
func times {
|
||||
with callable amount ;
|
||||
def i 0 =i
|
||||
callable [ while { i amount lt } {
|
||||
i
|
||||
i 1 + =i
|
||||
} ] foreach
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue