logo!!!! :D (thanks Max)
This commit is contained in:
18
README.md
18
README.md
@@ -1,5 +1,19 @@
|
|||||||
|

|
||||||
# VMBL
|
# VMBL
|
||||||
|
|
||||||
virtual machine based language lol
|
- Virtual
|
||||||
|
- Machine
|
||||||
|
- Based
|
||||||
|
- Language
|
||||||
|
|
||||||
to compile: `gcc src/main.c src/vmbl.c src/exception.c -o VMBL -O3`
|
But uhh that's the name of the VM itself, the name of the programming language I made is Sylt, named after the German island.
|
||||||
|
|
||||||
|
To compile for Linux: `gcc src/main.c src/vmbl.c src/exception.c -o VMBL -O3`
|
||||||
|
|
||||||
|
## Syntax
|
||||||
|
### Example "Hello, World!" Program
|
||||||
|
```kotlin
|
||||||
|
fun main() {
|
||||||
|
println("Hello, World!\n")
|
||||||
|
}
|
||||||
|
```
|
||||||
BIN
assets/sylt.png
Normal file
BIN
assets/sylt.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 82 KiB |
88
assets/sylt.svg
Normal file
88
assets/sylt.svg
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||||
|
|
||||||
|
<svg
|
||||||
|
width="210mm"
|
||||||
|
height="297mm"
|
||||||
|
viewBox="0 0 210 297"
|
||||||
|
version="1.1"
|
||||||
|
id="svg1"
|
||||||
|
inkscape:version="1.4.2 (ebf0e940d0, 2025-05-08)"
|
||||||
|
sodipodi:docname="sylt.svg"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg">
|
||||||
|
<sodipodi:namedview
|
||||||
|
id="namedview1"
|
||||||
|
pagecolor="#ffffff"
|
||||||
|
bordercolor="#000000"
|
||||||
|
borderopacity="0.25"
|
||||||
|
inkscape:showpageshadow="2"
|
||||||
|
inkscape:pageopacity="0.0"
|
||||||
|
inkscape:pagecheckerboard="0"
|
||||||
|
inkscape:deskcolor="#d1d1d1"
|
||||||
|
inkscape:document-units="mm"
|
||||||
|
inkscape:zoom="0.92725428"
|
||||||
|
inkscape:cx="703.15125"
|
||||||
|
inkscape:cy="587.21757"
|
||||||
|
inkscape:window-width="1908"
|
||||||
|
inkscape:window-height="1028"
|
||||||
|
inkscape:window-x="0"
|
||||||
|
inkscape:window-y="0"
|
||||||
|
inkscape:window-maximized="1"
|
||||||
|
inkscape:current-layer="layer1" />
|
||||||
|
<defs
|
||||||
|
id="defs1">
|
||||||
|
<linearGradient
|
||||||
|
id="linearGradient6"
|
||||||
|
inkscape:collect="always">
|
||||||
|
<stop
|
||||||
|
style="stop-color:#ffc8ff;stop-opacity:1;"
|
||||||
|
offset="0"
|
||||||
|
id="stop6" />
|
||||||
|
<stop
|
||||||
|
style="stop-color:#62d4b4;stop-opacity:1;"
|
||||||
|
offset="1"
|
||||||
|
id="stop7" />
|
||||||
|
</linearGradient>
|
||||||
|
<rect
|
||||||
|
x="335.39883"
|
||||||
|
y="352.65408"
|
||||||
|
width="234.02426"
|
||||||
|
height="207.06294"
|
||||||
|
id="rect4" />
|
||||||
|
<rect
|
||||||
|
x="315.70866"
|
||||||
|
y="375.19"
|
||||||
|
width="286.73057"
|
||||||
|
height="196.74598"
|
||||||
|
id="rect3" />
|
||||||
|
<rect
|
||||||
|
x="-391.96679"
|
||||||
|
y="288.25574"
|
||||||
|
width="359.93838"
|
||||||
|
height="347.73708"
|
||||||
|
id="rect2" />
|
||||||
|
<linearGradient
|
||||||
|
inkscape:collect="always"
|
||||||
|
xlink:href="#linearGradient6"
|
||||||
|
id="linearGradient7"
|
||||||
|
x1="-35.130647"
|
||||||
|
y1="113.59443"
|
||||||
|
x2="142.47032"
|
||||||
|
y2="113.59443"
|
||||||
|
gradientUnits="userSpaceOnUse"
|
||||||
|
gradientTransform="matrix(0.57397552,0,0,0.57375184,91.687588,61.074391)" />
|
||||||
|
</defs>
|
||||||
|
<g
|
||||||
|
inkscape:label="Layer 1"
|
||||||
|
inkscape:groupmode="layer"
|
||||||
|
id="layer1">
|
||||||
|
<path
|
||||||
|
id="path1"
|
||||||
|
style="fill:url(#linearGradient7);stroke:#000000;stroke-width:2;stroke-dasharray:none;stroke-opacity:0"
|
||||||
|
d="m 133.8419,76.355218 -36.053098,6.154146 69.496018,25.102346 -1.47278,-8.620665 z m -43.668137,13.718542 -10.86652,15.33601 92.284287,33.33441 0.81494,-1.14981 -3.24373,-18.98902 z m -16.68632,23.54895 -0.908472,1.28209 2.599325,15.21716 81.630164,29.48554 8.96379,-12.65039 z m 3.568774,27.4929 2.117184,12.39252 31.970139,22.63531 38.61832,-6.59133 1.2268,-1.73115 z" />
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 2.7 KiB |
3
examples/sylt/hello_world.sylt
Normal file
3
examples/sylt/hello_world.sylt
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
fun main() {
|
||||||
|
println("Hello, World!\n")
|
||||||
|
}
|
||||||
12
src/main.c
12
src/main.c
@@ -3,20 +3,16 @@
|
|||||||
#define ARRAY_SIZE(array) (sizeof(array) / sizeof(array[0]));
|
#define ARRAY_SIZE(array) (sizeof(array) / sizeof(array[0]));
|
||||||
|
|
||||||
VMBL_Instruction program[] = {
|
VMBL_Instruction program[] = {
|
||||||
|
MAKE_INST_PUSH(123),
|
||||||
MAKE_INST_PUSH(0),
|
MAKE_INST_PUSH(0),
|
||||||
MAKE_INST_PUSH(1),
|
MAKE_INST_DIV,
|
||||||
MAKE_INST_DUP(1),
|
|
||||||
MAKE_INST_DUP(1),
|
|
||||||
MAKE_INST_ADD,
|
|
||||||
|
|
||||||
MAKE_INST_JMP(2),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
VMBL_State vmblState = {};
|
VMBL_State vmblState = {};
|
||||||
|
|
||||||
VMBL_LoadExecutable(&vmblState, program, sizeof(program));
|
//VMBL_LoadExecutable(&vmblState, program, sizeof(program));
|
||||||
VMBL_SaveExecutable("fib.vmbl", program, sizeof(program));
|
//VMBL_SaveExecutable("fib.vmbl", program, sizeof(program));
|
||||||
VMBL_LoadExecutableFromFile(&vmblState, "fib.vmbl");
|
VMBL_LoadExecutableFromFile(&vmblState, "fib.vmbl");
|
||||||
VMBL_StartVM(&vmblState);
|
VMBL_StartVM(&vmblState);
|
||||||
|
|
||||||
|
|||||||
@@ -62,10 +62,13 @@ typedef struct
|
|||||||
} VMBL_State;
|
} VMBL_State;
|
||||||
|
|
||||||
#define MAKE_INST_PUSH(value) (VMBL_Instruction) { .type = INSTRUCTION_PUSH, .opperands[0] = (value) }
|
#define MAKE_INST_PUSH(value) (VMBL_Instruction) { .type = INSTRUCTION_PUSH, .opperands[0] = (value) }
|
||||||
#define MAKE_INST_POP (VMBL_Instruction) { .type = INSTRUCTION_POP, }
|
#define MAKE_INST_POP (VMBL_Instruction) { .type = INSTRUCTION_POP }
|
||||||
#define MAKE_INST_ADD (VMBL_Instruction) { .type = INSTRUCTION_ADD }
|
#define MAKE_INST_ADD (VMBL_Instruction) { .type = INSTRUCTION_ADD }
|
||||||
|
#define MAKE_INST_SUB (VMBL_Instruction) { .type = INSTRUCTION_SUB }
|
||||||
|
#define MAKE_INST_MUL (VMBL_Instruction) { .type = INSTRUCTION_MUL }
|
||||||
|
#define MAKE_INST_DIV (VMBL_Instruction) { .type = INSTRUCTION_DIV }
|
||||||
#define MAKE_INST_DUP(value) (VMBL_Instruction) { .type = INSTRUCTION_DUPLICATE, .opperands[0] = (value) }
|
#define MAKE_INST_DUP(value) (VMBL_Instruction) { .type = INSTRUCTION_DUPLICATE, .opperands[0] = (value) }
|
||||||
#define MAKE_INST_JMP(value) (VMBL_Instruction) { .type = INSTRUCTION_JUMP , .opperands[0] = (value) }
|
#define MAKE_INST_JMP(value) (VMBL_Instruction) { .type = INSTRUCTION_JUMP, .opperands[0] = (value) }
|
||||||
#define MAKE_INST_HALT (VMBL_Instruction) { .type = INSTRUCTION_HALT }
|
#define MAKE_INST_HALT (VMBL_Instruction) { .type = INSTRUCTION_HALT }
|
||||||
#define MAKE_INST_EQUAL(stack1, stack2) (VMBL_Instruction) { .type = INSTRUCTION_EQUAL, .opperands[0] = (stack1), .opperands[1] = (stack2) }
|
#define MAKE_INST_EQUAL(stack1, stack2) (VMBL_Instruction) { .type = INSTRUCTION_EQUAL, .opperands[0] = (stack1), .opperands[1] = (stack2) }
|
||||||
#define MAKE_INST_EQUAL_TOP (VMBL_Instruction) { .type = INSTRUCTION_EQUAL_TOP }
|
#define MAKE_INST_EQUAL_TOP (VMBL_Instruction) { .type = INSTRUCTION_EQUAL_TOP }
|
||||||
|
|||||||
Reference in New Issue
Block a user