-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Documment a few language features * Add an example for foreign example * Fix pre-commit warnings * remove what-is-org * Ignore README.org in docs folder * Add fixes for revisions
- Loading branch information
1 parent
65a44e0
commit 30ae6c7
Showing
21 changed files
with
444 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -74,3 +74,5 @@ docs/md/ | |
_docs | ||
docs/**/*.md | ||
**/html/* | ||
|
||
docs/org/README.org |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,40 @@ | ||
* Summary | ||
|
||
- [[./introduction/about/what-is.md][Juvix]] | ||
- [[./README.md][The Juvix project]] | ||
- [[./introduction/changelog.md][Changelog]] | ||
- [[./getting-started/README.md][Getting started]] | ||
- [[./getting-started/quick-start.md][Quick start]] | ||
- [[./getting-started/dependencies.md][Installing dependencies]] | ||
- [[./examples/README.md][Tutorials]] | ||
- [[./examples/backend-specific/minic-hello-world.md][Hello world]] | ||
- [[./examples/validity-predicates/PolyFungibleToken.md][A simple fungible token]] | ||
- [[./examples/README.md][Juvix Examples]] | ||
|
||
- [[./language-reference/README.md][Language reference]] | ||
- [[./language-reference/comments.md][Comments]] | ||
- [[./language-reference/axiom.md][Axiom]] | ||
- [[./language-reference/functions.md][Function]] | ||
- [[./language-reference/modules.md][Module]] | ||
- [[./language-reference/inductive-data-types.md][Data type]] | ||
- [[./language-reference/termination-checking.md][Termination checking]] | ||
- [[./language-reference/compile-blocks.md][Compile block]] | ||
- [[./language-reference/foreign-blocks.md][Foreign block]] | ||
- [[./backends/README.md][Backends]] | ||
- [[./backends/minic.md][MiniC]] | ||
- [[./backends/minihaskell.md][MiniHaskell]] | ||
- [[./compiler-architecture/README][Compiler architecture]] | ||
- [[./compiler-architecture/pipeline.md][Pipeline]] | ||
- [[./compiler-architecture/languages.md][Internal languages]] | ||
- [[./compiler-architecture/language/abstract.md][Abstract language]] | ||
- [[./compiler-architecture/language/concrete.md][Concrete language]] | ||
- [[./compiler-architecture/language/microjuvix.md][MicroJuvix]] | ||
- [[./language-reference/termination-checking.md][Termination]] | ||
# - [[./backends/README.md][Backends]] | ||
# - [[./backends/minic.md][C]]s | ||
# - [[./backends/minihaskell.md][Haskell]] | ||
# - [[./compiler-architecture/README][Compiler architecture]] | ||
# - [[./compiler-architecture/pipeline.md][Pipeline]] | ||
# - [[./compiler-architecture/languages.md][Internal languages]] | ||
# - [[./compiler-architecture/language/abstract.md][Abstract language]] | ||
# - [[./compiler-architecture/language/concrete.md][Concrete language]] | ||
# - [[./compiler-architecture/language/microjuvix.md][MicroJuvix]] | ||
|
||
- [[./tooling/README.md][Tooling]] | ||
- [[./tooling/CLI.md][Command line interface]] | ||
- [[./tooling/emacs-mode.md][Emacs mode]] | ||
- [[./tooling/testing.md][Haskell test suite]] | ||
|
||
- [[./notes/README.md][Blog]] | ||
- [[./notes/README.md][Notes]] | ||
- [[./examples/validity-predicates/README.md][Validity predicates]] | ||
- [[./notes/monomorphization.md][Monomorphization]] | ||
|
||
- [[./introduction/about/what-is.md][About]] | ||
- [[./introduction/about/team.md][The dev team]] | ||
# - [[./introduction/about/team.md][The dev team]] | ||
- [[./introduction/about/community.md][Community]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,9 @@ | ||
- [[./backend-specific/minic-hello-world.md][Hello world]] | ||
- [[./validity-predicates/PolyFungibleToken.md][Fungible Token]] | ||
** [[https://github.com/anoma/juvix/tree/main/examples/milestone][Examples of programs written in Juvix]] | ||
|
||
The following links are clickable versions of their corresponding Juvix programs. The HTML output can be generated by running =juvix html --recursive FileName.juvix=. | ||
|
||
- [[https://anoma.github.io/juvix-stdlib/][The Juvix standard library]] | ||
- [[https://docs.juvix.org/examples/html/ValidityPredicates/SimpleFungibleToken.html][SimpleFungibleToken.juvix]] | ||
- [[https://docs.juvix.org/examples/html/Collatz/Collatz.html][Collatz.juvix]] | ||
- [[https://docs.juvix.org/examples/html/Fibonacci/Fibonacci.html][Fibonacci.juvix]] | ||
- [[https://docs.juvix.org/examples/html/MiniTicTacToe/MiniTicTacToe.html][MiniTicTacToe.juvix]] |
2 changes: 1 addition & 1 deletion
2
docs/org/examples/backend-specific/minic-hello-world.org
100644 → 100755
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
* Mini C Hello World | ||
* Hello World | ||
|
||
In the following example a Juvix file is compiled using the C backend. | ||
|
||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
|
||
* Built-ins | ||
|
||
Juvix has support for the built-in natural type and a few functions that are compiled to efficient primitives. | ||
|
||
1. Built-in inductive definitions. | ||
|
||
#+begin_example | ||
builtin natural | ||
inductive Nat { | ||
zero : Nat; | ||
suc : Nat → Nat; | ||
}; | ||
#+end_example | ||
|
||
2. Builtin function definitions. | ||
|
||
#+begin_example | ||
inifl 6 +; | ||
builtin natural-plus | ||
+ : Nat → Nat → Nat; | ||
+ zero b ≔ b; | ||
+ (suc a) b ≔ suc (a + b); | ||
#+end_example | ||
|
||
3. Builtin axiom definitions. | ||
|
||
#+begin_example | ||
builtin natural-print | ||
axiom printNat : Nat → Action; | ||
#+end_example |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
docs/org/language-reference/compile-blocks.org
100644 → 100755
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,65 @@ | ||
* 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: | ||
|
||
#+begin_src haskell | ||
$ cat tests/positive/HelloWorld | ||
... | ||
axiom Action : Type; | ||
compile Action { | ||
ghc ↦ "IO ()"; | ||
}; | ||
... | ||
#+end_src | ||
|
||
The following Juvix examples are NOT valid. | ||
|
||
- One can not repeat backend inside a =compile= block. | ||
|
||
#+begin_src haskell | ||
... | ||
axiom Action : Type; | ||
compile Action { | ||
ghc ↦ "IO ()"; | ||
ghc ↦ "IO ()"; -- | ||
}; | ||
... | ||
#+end_src | ||
|
||
- One name, one compile block, no more. | ||
|
||
#+begin_src haskell | ||
... | ||
axiom Action : Type; | ||
compile Action { | ||
ghc ↦ "IO ()"; | ||
}; | ||
compile Action { | ||
ghc ↦ "IO ()"; | ||
}; | ||
... | ||
#+end_src | ||
|
||
- A compile block must be in the same module as their name definition. | ||
|
||
#+begin_src haskell | ||
$ cat A.mjuvix | ||
... | ||
axiom Action : Type; | ||
... | ||
#+end_src | ||
|
||
#+begin_src haskell | ||
$ cat B.mjuvix | ||
... | ||
compile Action { | ||
ghc ↦ "IO ()"; | ||
}; | ||
... | ||
#+end_src |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,36 @@ | ||
* Foreign blocks | ||
|
||
The =foreign= blocks give the developer the ability to introduce any piece of | ||
code in the compiled file. In addition, every foreign block specifies the | ||
backend's name that will include the given code in the body of the foreign | ||
block. | ||
|
||
The following is an example taken from the Juvix standard library. | ||
|
||
#+begin_example | ||
module Integers; | ||
|
||
axiom Int : Type; | ||
compile Int { c ↦ "int" }; | ||
|
||
foreign c { | ||
bool lessThan(int l, int r) { | ||
return l < r; | ||
\} | ||
}; | ||
|
||
inductive Bool { | ||
true : Bool; | ||
false : Bool; | ||
}; | ||
|
||
infix 4 <'; | ||
axiom <' : Int → Int → Bool; | ||
compile <' { | ||
c ↦ "lessThan"; | ||
}; | ||
|
||
infix 4 <; | ||
< : Int → Int → Bool; | ||
< a b ≔ from-backend-bool (a <' b); | ||
#+end_example |
Oops, something went wrong.