2022-02-05 13:38:24 +01:00
|
|
|
# isbpl
|
|
|
|
Improved Stack-Based Programming Language
|
2022-02-05 21:49:02 +01:00
|
|
|
|
2022-03-06 00:14:33 +01:00
|
|
|
Incomplete, not currently compilable, only interpretable.
|
2022-03-12 20:09:15 +01:00
|
|
|
|
|
|
|
Stuff: [TudbuT/isbpl-random-stuff](https://github.com/TudbuT/isbpl-random-stuff)
|
2022-03-13 03:31:37 +01:00
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
## ISBPL is similar to Lisp:
|
|
|
|
|
|
|
|
```lisp
|
|
|
|
(print (+ 1 (* 1 2)))
|
|
|
|
```
|
|
|
|
is the same as
|
|
|
|
```isbpl
|
|
|
|
2 1 * 1 + print
|
|
|
|
```
|
|
|
|
or
|
|
|
|
```isbpl
|
2022-10-02 22:23:32 +02:00
|
|
|
(((2 1 *) 1 +) print)
|
2022-03-13 03:31:37 +01:00
|
|
|
```
|
|
|
|
in both languages, this will print 3.
|
|
|
|
|
|
|
|
These examples used the print function, which does not exist by default, instead, puts should be used in combination with \_string.
|
2022-04-16 01:45:17 +02:00
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
## Objects, Functions, and Variables in ISBPL
|
|
|
|
OOP works like this:
|
|
|
|
|
|
|
|
- There are three separate function resolvers:
|
|
|
|
- Object
|
|
|
|
- Local
|
2022-05-09 15:24:11 +02:00
|
|
|
- (Multiple more levels determined by the frame height)
|
2022-04-16 01:45:17 +02:00
|
|
|
- Global
|
|
|
|
- They are executed in the order shown above
|
|
|
|
- The object resolver peeks onto the stack, gets the type of the object, and checks for methods on the type, if it finds one, it executes it
|
|
|
|
- The local resolver checks for functions defined in the current function, but not in any other function or area
|
|
|
|
- The global resolver checks for top-level functions, meaning ones that arent in any other function.
|
|
|
|
- Because variables are native functions under the hood, they are also called by the function resolvers
|
|
|
|
- Object-local variables are in a Table: `Type?->Instance?->ID?->Value`
|
|
|
|
|
|
|
|
### To call a method of an object:
|
|
|
|
|
|
|
|
```isbpl
|
|
|
|
parameter1 parameter2 etc object method
|
|
|
|
```
|
2022-04-16 01:45:48 +02:00
|
|
|
As explained above, methods are resolved separately, and it is therefore not required to define them in any other way.
|