-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
73 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
-- This module serves as the root of the `Juvix` library. | ||
-- Import modules here that should be built as part of the library. | ||
import Juvix.Basic | ||
import Juvix.Core.Main |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
|
||
import Juvix.Core.Main.Language | ||
import Juvix.Core.Main.Semantics |
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,3 @@ | ||
|
||
import Juvix.Core.Main.Language.Base | ||
import Juvix.Core.Main.Language.Value |
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,40 @@ | ||
|
||
namespace Juvix.Core.Main | ||
|
||
abbrev Name : Type := String | ||
|
||
inductive Constant : Type where | ||
| int : Int → Constant | ||
| string : String → Constant | ||
deriving Inhabited, DecidableEq | ||
|
||
inductive BuiltinOp : Type where | ||
| add_int : BuiltinOp | ||
| sub_int : BuiltinOp | ||
| mul_int : BuiltinOp | ||
| div_int : BuiltinOp | ||
deriving Inhabited, DecidableEq | ||
|
||
mutual | ||
inductive Expr : Type where | ||
| var : Nat → Expr | ||
| ident : Name → Expr | ||
| const : Constant → Expr | ||
| app : Expr → Expr → Expr | ||
| builtin_app : (oper : BuiltinOp) → (args : List Expr) → Expr | ||
| constr_app : (constr : Name) → (args : List Expr) → Expr | ||
| lambda : (body : Expr) → Expr | ||
| let : (value : Expr) → (body : Expr) → Expr | ||
| case : (value : Expr) → (branches : List CaseBranch) → Expr | ||
| unit : Expr | ||
deriving Inhabited | ||
|
||
structure CaseBranch where | ||
constr : Name | ||
body : Expr | ||
end | ||
|
||
structure Program where | ||
defs : List Expr | ||
|
||
end Juvix.Core.Main |
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,15 @@ | ||
|
||
import Juvix.Core.Main.Language.Base | ||
|
||
namespace Juvix.Core.Main | ||
|
||
inductive Value : Type where | ||
| const : Constant → Value | ||
| constr_app : (constr : Name) → (args : List Value) → Value | ||
| closure : (ctx : List Value) → (value : Expr) → Value | ||
| unit : Value | ||
deriving Inhabited | ||
|
||
abbrev Context : Type := List Value | ||
|
||
end Juvix.Core.Main |
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,11 @@ | ||
|
||
import Juvix.Core.Main.Language | ||
|
||
namespace Juvix.Core.Main | ||
|
||
def f : Expr -> Expr := λ e => | ||
match e with | ||
| Expr.lambda (body := e) => e | ||
| _ => Expr.lambda (body := e) | ||
|
||
end Juvix.Core.Main |
Empty file.
Empty file.
Empty file.
Empty file.