2019-08-26 16:43:07 +00:00
|
|
|
# vig
|
2019-08-24 19:31:13 +00:00
|
|
|
|
2019-08-26 17:26:58 +00:00
|
|
|
a [v] parser in zig, also a shitpost taken too far
|
2019-08-26 16:43:07 +00:00
|
|
|
|
|
|
|
[v]: https://vlang.io
|
|
|
|
|
|
|
|
(will likely be done as a full compiler, who knows, leave a like and subscribe
|
|
|
|
for more epic adventures)
|
2019-08-24 19:31:13 +00:00
|
|
|
|
|
|
|
## why
|
|
|
|
|
2019-08-26 17:26:58 +00:00
|
|
|
- because i want to learn parsers and what best to do it with a language i'm
|
2019-08-26 16:43:07 +00:00
|
|
|
negatively charged towards
|
2019-08-26 17:26:58 +00:00
|
|
|
- theres an ast now it looks pretty
|
|
|
|
- i finally understand recursive descent parsers
|
2019-08-24 19:31:13 +00:00
|
|
|
|
2019-08-25 19:49:08 +00:00
|
|
|
## variations
|
|
|
|
|
|
|
|
- `for` is split between `for` and `loop` because my fucking god i cant stand
|
2019-08-26 17:26:58 +00:00
|
|
|
having *four* different variations of `for` to parse.
|
2019-08-25 19:49:08 +00:00
|
|
|
|
2019-08-26 14:59:32 +00:00
|
|
|
- struct initialization is with `Struct.{}`, not `Struct{}`, to remove parsing
|
2019-08-26 17:26:58 +00:00
|
|
|
ambiguities (`if a {}` and `a{}`, v solves that with case, e.g structs Must
|
|
|
|
Be Properly Titled and i can't bother with that)
|
2019-08-26 14:59:32 +00:00
|
|
|
|
2019-08-27 00:57:01 +00:00
|
|
|
- function parameters must have a type always
|
2019-08-27 15:39:17 +00:00
|
|
|
(no `fn blah(x, y int)`, must be `fn blah(x int, y int)`)
|
|
|
|
- ifs are always statements, not expressions
|
|
|
|
(can't use if as an r-value: `x := if ...`)
|
|
|
|
- no `++`, `--` (use `+=` and `-=`)
|
2019-08-27 00:57:01 +00:00
|
|
|
- no `match`
|
|
|
|
- no embedded structs
|
2019-08-27 15:39:17 +00:00
|
|
|
- no enum literals (`x = .val2`)
|
2019-08-27 01:42:39 +00:00
|
|
|
- no v orm
|
|
|
|
- no codegen
|
|
|
|
- no inline assembly
|
2019-08-27 00:57:01 +00:00
|
|
|
|
2019-08-27 01:44:36 +00:00
|
|
|
## wip
|
2019-08-26 17:30:13 +00:00
|
|
|
|
2019-08-27 00:57:01 +00:00
|
|
|
- no `map` yet
|
|
|
|
- no `in` yet (probably will be dropped)
|
2019-08-27 01:42:39 +00:00
|
|
|
- no `module`, `import` yet
|
|
|
|
- no interfaces yet
|
|
|
|
- no generics yet
|
|
|
|
- no attributes yet (`[live]`, `[skip]`)
|
|
|
|
- no `defer` yet
|
2019-08-27 15:39:17 +00:00
|
|
|
- no `switch` yet
|
2019-08-27 01:42:39 +00:00
|
|
|
- no operator overloading methods yet
|
|
|
|
- do we really want a type system (optionals included)
|
2019-08-27 01:44:36 +00:00
|
|
|
- no error handling yet (`call() or {blah}`)
|
|
|
|
- no `?` postfix operator yet (`call()?`)
|
2019-08-26 17:30:13 +00:00
|
|
|
- do we really want to output c
|
|
|
|
- do we really want to output llvm
|
|
|
|
- do we really want to output x86
|
|
|
|
|
2019-08-24 19:31:13 +00:00
|
|
|
## how
|
|
|
|
|
2019-08-27 15:47:09 +00:00
|
|
|
```
|
2019-08-26 16:43:07 +00:00
|
|
|
git clone https://gitdab.com/luna/vig.git
|
|
|
|
cd vig
|
2019-08-24 19:31:13 +00:00
|
|
|
zig build install --prefix ~/.local/
|
|
|
|
```
|