blob: 0098b9036cc23dded7e6e8f405826f98dfce2260 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
# [GOLEM](https://kdx.re/cgit/golem)
## Introduction
Programming language.
Designed for losers, by a loser.
Here's GOLEM's grandiose resume, please be nice: GOLEM is quite shy.
* no typing, everything is a shitty unsigned integer
* no complexity, made to be super simple to parse
* no ambiguity, there's only one shitty way to do each shitty thing
* no safety, every unsigned integer is also a pointer
* no abstraction, there ain't no stdlib
Here's some cute GOLEM code.
```golem
fn main(argc, argv) {
var i;
var ret;
var ptr;
var arr;
i = 2;
powed = 1;
arr = alloc(argc);
while i < argc {
arr[i] = atoi(argv[i]);
powed *= arr[i];
}
// bad heap management
heap -= argc;
// GOLEM has no * deference and uses $ for reference
ptr = $i;
ret += ptr[0];
return ret;
}
fn alloc(size) {
var ptr;
ptr = heap;
heap += size;
return ptr;
}
fn atoi(str) {
// <--- good code here
return 2038;
}
```
GOLEM is pretty much dumber
[C](https://en.wikipedia.org/wiki/C_programming_language),
think [B](https://en.wikipedia.org/wiki/B_programming_language) 2.0.69.
## Why?
GOLEM's goal is to be used on custom made virtual machines at a very low level
of abstraction.
GOLEM code is easy and pleasantly simple to write.
It's sheer simplicity makes it easily expandable.
I fucking wanted to make it.
## Project state
`[ ]` lexer
* `[x]` word
* `[x]` decimal litteral
* `[ ]` hexadecimal litteral
* `[ ]` binary litteral
* `[ ]` char litteral
* `[x]` string litteral
* `[x]` `var`
* `[x]` `const`
* `[x]` `fn`
* `[x]` `if`
* `[x]` `else`
* `[x]` `while`
* `[x]` `(`
* `[x]` `)`
* `[x]` `{`
* `[x]` `}`
* `[x]` `[`
* `[x]` `]`
* `[x]` `:`
* `[x]` `;`
* `[x]` `=`
* `[ ]` `+=`
* `[ ]` `-=`
* `[ ]` `*=`
* `[ ]` `/=`
* `[ ]` `%=`
* `[ ]` `&=`
* `[ ]` `|=`
* `[ ]` `^=`
* `[x]` `+`
* `[x]` `-`
* `[x]` `*`
* `[x]` `/`
* `[x]` `%`
* `[x]` `&`
* `[x]` `|`
* `[x]` `^`
* `[x]` `$`
* `[x]` `!`
* `[x]` `==`
* `[x]` `!=`
* `[x]` `<`
* `[x]` `>`
* `[x]` `<=`
* `[x]` `>=`
* `[x]` `||`
* `[x]` `&&`
* `[x]` `//`
|