Email or username:

Password:

Forgot your password?
Top-level
(wryl)

@dziban A lot of this is correct, and a lot of it is simpler than you've specified.

Variable assignment and expression evaluation isn't a built-in feature of the language, but instead considered a part of the standard library.

Rule priority is source-order, and rules consume the tuples they match. The left-hand side of a rule is the tuples it consumes, while the right-hand side is the tuples it produces.

I've updated the snippet with more code.

gitlab.com/-/snippets/3716812

4 comments
Marce Coll

@wryl how does this standard library work? is it literally some rules provided that operate on the same tuple system? how does addition work under this?

Marce Coll

@wryl ah, nevermind, just ppened your examples and saw the arithmetic part

Marce Coll

@wryl so addition is specified in terms of tuple replacement using something like peano numbers?

(wryl)

@dziban It is, indeed, just some rules. "Compilation" is concatenation of rule-sets.

The current implementation of Nova allows for an "escape hatch" in the form of patterns that are prefixed with a '%'.

For the current implementation, rules are parsed and compiled to a form of byte-code that incorporates a stack.

So..

%$variable = 1 2 +.

..results in a tuple that looks like..

$variable = 3

The new implementation will not feature this, as this was done for demonstration purposes.

Go Up