Crates.io | rigz_runtime |
lib.rs | rigz_runtime |
version | 0.4.0 |
source | src |
created_at | 2024-05-11 02:58:50.129508 |
updated_at | 2024-11-04 20:10:02.509088 |
description | Handles parsing and converting rigz to its VM instructions (for syntax highlighting use tree-sitter-rigz instead) |
homepage | |
repository | https://gitlab.com/inapinch/rigz/crates/runtime |
max_upload_size | |
id | 1236569 |
size | 95,323 |
Handles parsing and converting rigz to its VM instructions.
This is an AST parser, but as soon as it has an element that would be in the AST that element is converted into VM
instructions. Tokens and expressions are read from left to right, there is no operator precedence.
This means that 1 + 2 * 3
is not equal to 3 * 2 + 1
; the first is 9, (1 + 2) * 3, while the
second is 7, (3 * 2) + 1.
update parser to support repl, may require VM updates as well
Better error messages
@on("event")
fn new_event(e)
end
dispatch('event', {
something: 32
})
@plan
fn foo
end
@apply
fn foo
end
[parse, run]
@plan = @after(@run)
@apply = @after(@plan, @confirm)
[parse, run, @plan, @confirm, @apply]
@plan
fn s3_bucket(name: string)
end
@apply
fn s3_bucket(name: string)
end
s3_bucket foo
allow data.external {
bin = "foo"
}
create_table foo, do |t|
t.string bar
t.column baz, :number
t.timestamps
end
let a = $('cat file')
$```ruby
## todo
- support multiple parsers
- default ignore precedence; 1 + 2 * 3 = 9
- right recursive precedence; 1 + 2 * 3 = 7
- pratt parser; 1 + 2 * 3 / 4 = 2.5