1
1
mirror of https://github.com/anoma/juvix.git synced 2025-01-08 08:39:26 +03:00
juvix/docs/org/language-reference/compile-blocks.org
Paul Cadman 509e9e54fd
Update language reference to match current state of Juvix (#1594)
* docs: ℕ to Nat

* docs: Add emacs goto definition

* Document juvix-format-buffer and add emacs keybinding

* docs: replace ghc with c in compile block examples

* Update CLI documentation

* doc: replace ↦ and → with ->
2022-10-24 10:44:05 +02:00

971 B
Executable File

Compile blocks

The compile keyword has two arguments:

  • A name of an expression to be compiled.
  • A set of compilation rules using the format (backend -> string) where the string is the text we inline.

This is an example:

$ cat tests/positive/HelloWorld
...
axiom Action : Type;
compile Action {
  c -> "int";
};
...

The following Juvix examples are NOT valid.

  • One can not repeat backend inside a compile block.
...
axiom Action : Type;
compile Action {
 c -> "int";
 c -> "int";  --
};
...
  • One name, one compile block, no more.
...
axiom Action : Type;
compile Action {
 c -> "int";
};
compile Action {
 c -> "int";
};
...
  • A compile block must be in the same module as their name definition.
$ cat A.mjuvix
...
axiom Action : Type;
...
$ cat B.mjuvix
...
compile Action {
 c -> "int";
};
...