From 38fe0f8c168817de06ca28f250e39f9aa5e05dc4 Mon Sep 17 00:00:00 2001 From: Michael Lazear Date: Sun, 26 Jul 2020 16:12:55 -0700 Subject: [PATCH] Fix broken test, clean up repo a bit --- {arith => 01_arith}/Cargo.toml | 0 {arith => 01_arith}/src/lexer.rs | 0 {arith => 01_arith}/src/main.rs | 0 {arith => 01_arith}/src/parser.rs | 0 {lambda => 02_lambda}/Cargo.toml | 0 {lambda => 02_lambda}/src/context.rs | 0 {lambda => 02_lambda}/src/lexer.rs | 0 {lambda => 02_lambda}/src/main.rs | 0 {lambda => 02_lambda}/src/parser.rs | 0 {typedarith => 03_typedarith}/Cargo.toml | 0 {typedarith => 03_typedarith}/src/ast.rs | 0 {typedarith => 03_typedarith}/src/lexer.rs | 0 {typedarith => 03_typedarith}/src/main.rs | 0 {typedarith => 03_typedarith}/src/parser.rs | 0 {stlc => 04_stlc}/.gitignore | 0 {stlc => 04_stlc}/Cargo.toml | 0 {stlc => 04_stlc}/src/eval.rs | 0 {stlc => 04_stlc}/src/lexer.rs | 0 {stlc => 04_stlc}/src/main.rs | 0 {stlc => 04_stlc}/src/parser.rs | 0 {stlc => 04_stlc}/src/term.rs | 0 {stlc => 04_stlc}/src/typing.rs | 0 {stlc => 04_stlc}/src/visitor.rs | 0 {recon => 05_recon}/Cargo.toml | 0 {recon => 05_recon}/src/disjoint.rs | 28 ------------------- {recon => 05_recon}/src/main.rs | 0 {recon => 05_recon}/src/mutation/mod.rs | 0 .../src/mutation/write_once.rs | 0 {recon => 05_recon}/src/naive.rs | 0 {recon => 05_recon}/src/parser.rs | 0 {recon => 05_recon}/src/types.rs | 0 {system_f => 06_system_f}/Cargo.toml | 0 {system_f => 06_system_f}/README.md | 0 {system_f => 06_system_f}/src/diagnostics.rs | 0 {system_f => 06_system_f}/src/eval.rs | 0 {system_f => 06_system_f}/src/macros.rs | 0 {system_f => 06_system_f}/src/main.rs | 0 {system_f => 06_system_f}/src/patterns/mod.rs | 0 {system_f => 06_system_f}/src/syntax/lexer.rs | 0 {system_f => 06_system_f}/src/syntax/mod.rs | 0 .../src/syntax/parser.rs | 0 {system_f => 06_system_f}/src/terms/mod.rs | 0 {system_f => 06_system_f}/src/terms/visit.rs | 0 {system_f => 06_system_f}/src/types/mod.rs | 0 .../src/types/patterns.rs | 0 {system_f => 06_system_f}/src/types/visit.rs | 0 {system_f => 06_system_f}/src/visit.rs | 0 {system_f => 06_system_f}/test.sf | 0 {system_fw => 07_system_fw}/Cargo.toml | 0 {system_fw => 07_system_fw}/README.md | 0 .../src/diagnostics.rs | 0 {system_fw => 07_system_fw}/src/elaborate.rs | 0 {system_fw => 07_system_fw}/src/functor.rs | 0 {system_fw => 07_system_fw}/src/hir/bidir.rs | 0 {system_fw => 07_system_fw}/src/hir/mod.rs | 0 {system_fw => 07_system_fw}/src/macros.rs | 0 {system_fw => 07_system_fw}/src/main.rs | 0 {system_fw => 07_system_fw}/src/stack.rs | 0 {system_fw => 07_system_fw}/src/syntax/ast.rs | 0 .../src/syntax/lexer.rs | 0 {system_fw => 07_system_fw}/src/syntax/mod.rs | 0 .../src/syntax/parser/README.md | 0 .../src/syntax/parser/decls.rs | 0 .../src/syntax/parser/exprs.rs | 0 .../src/syntax/parser/infix.rs | 0 .../src/syntax/parser/mod.rs | 0 .../src/syntax/parser/patterns.rs | 0 .../src/syntax/parser/types.rs | 0 .../src/syntax/tokens.rs | 0 .../src/syntax/visit/mod.rs | 0 .../src/syntax/visit/types.rs | 0 {system_fw => 07_system_fw}/src/terms.rs | 0 {system_fw => 07_system_fw}/src/typecheck.rs | 0 {system_fw => 07_system_fw}/src/types.rs | 0 {system_fw => 07_system_fw}/test.fw | 0 Cargo.toml | 2 +- README.md | 20 ++++--------- {bidir => x1_bidir}/Cargo.toml | 0 {bidir => x1_bidir}/src/helpers.rs | 0 {bidir => x1_bidir}/src/main.rs | 0 {dependent => x2_dependent}/Cargo.toml | 0 {dependent => x2_dependent}/src/main.rs | 0 82 files changed, 7 insertions(+), 43 deletions(-) rename {arith => 01_arith}/Cargo.toml (100%) rename {arith => 01_arith}/src/lexer.rs (100%) rename {arith => 01_arith}/src/main.rs (100%) rename {arith => 01_arith}/src/parser.rs (100%) rename {lambda => 02_lambda}/Cargo.toml (100%) rename {lambda => 02_lambda}/src/context.rs (100%) rename {lambda => 02_lambda}/src/lexer.rs (100%) rename {lambda => 02_lambda}/src/main.rs (100%) rename {lambda => 02_lambda}/src/parser.rs (100%) rename {typedarith => 03_typedarith}/Cargo.toml (100%) rename {typedarith => 03_typedarith}/src/ast.rs (100%) rename {typedarith => 03_typedarith}/src/lexer.rs (100%) rename {typedarith => 03_typedarith}/src/main.rs (100%) rename {typedarith => 03_typedarith}/src/parser.rs (100%) rename {stlc => 04_stlc}/.gitignore (100%) rename {stlc => 04_stlc}/Cargo.toml (100%) rename {stlc => 04_stlc}/src/eval.rs (100%) rename {stlc => 04_stlc}/src/lexer.rs (100%) rename {stlc => 04_stlc}/src/main.rs (100%) rename {stlc => 04_stlc}/src/parser.rs (100%) rename {stlc => 04_stlc}/src/term.rs (100%) rename {stlc => 04_stlc}/src/typing.rs (100%) rename {stlc => 04_stlc}/src/visitor.rs (100%) rename {recon => 05_recon}/Cargo.toml (100%) rename {recon => 05_recon}/src/disjoint.rs (92%) rename {recon => 05_recon}/src/main.rs (100%) rename {recon => 05_recon}/src/mutation/mod.rs (100%) rename {recon => 05_recon}/src/mutation/write_once.rs (100%) rename {recon => 05_recon}/src/naive.rs (100%) rename {recon => 05_recon}/src/parser.rs (100%) rename {recon => 05_recon}/src/types.rs (100%) rename {system_f => 06_system_f}/Cargo.toml (100%) rename {system_f => 06_system_f}/README.md (100%) rename {system_f => 06_system_f}/src/diagnostics.rs (100%) rename {system_f => 06_system_f}/src/eval.rs (100%) rename {system_f => 06_system_f}/src/macros.rs (100%) rename {system_f => 06_system_f}/src/main.rs (100%) rename {system_f => 06_system_f}/src/patterns/mod.rs (100%) rename {system_f => 06_system_f}/src/syntax/lexer.rs (100%) rename {system_f => 06_system_f}/src/syntax/mod.rs (100%) rename {system_f => 06_system_f}/src/syntax/parser.rs (100%) rename {system_f => 06_system_f}/src/terms/mod.rs (100%) rename {system_f => 06_system_f}/src/terms/visit.rs (100%) rename {system_f => 06_system_f}/src/types/mod.rs (100%) rename {system_f => 06_system_f}/src/types/patterns.rs (100%) rename {system_f => 06_system_f}/src/types/visit.rs (100%) rename {system_f => 06_system_f}/src/visit.rs (100%) rename {system_f => 06_system_f}/test.sf (100%) rename {system_fw => 07_system_fw}/Cargo.toml (100%) rename {system_fw => 07_system_fw}/README.md (100%) rename {system_fw => 07_system_fw}/src/diagnostics.rs (100%) rename {system_fw => 07_system_fw}/src/elaborate.rs (100%) rename {system_fw => 07_system_fw}/src/functor.rs (100%) rename {system_fw => 07_system_fw}/src/hir/bidir.rs (100%) rename {system_fw => 07_system_fw}/src/hir/mod.rs (100%) rename {system_fw => 07_system_fw}/src/macros.rs (100%) rename {system_fw => 07_system_fw}/src/main.rs (100%) rename {system_fw => 07_system_fw}/src/stack.rs (100%) rename {system_fw => 07_system_fw}/src/syntax/ast.rs (100%) rename {system_fw => 07_system_fw}/src/syntax/lexer.rs (100%) rename {system_fw => 07_system_fw}/src/syntax/mod.rs (100%) rename {system_fw => 07_system_fw}/src/syntax/parser/README.md (100%) rename {system_fw => 07_system_fw}/src/syntax/parser/decls.rs (100%) rename {system_fw => 07_system_fw}/src/syntax/parser/exprs.rs (100%) rename {system_fw => 07_system_fw}/src/syntax/parser/infix.rs (100%) rename {system_fw => 07_system_fw}/src/syntax/parser/mod.rs (100%) rename {system_fw => 07_system_fw}/src/syntax/parser/patterns.rs (100%) rename {system_fw => 07_system_fw}/src/syntax/parser/types.rs (100%) rename {system_fw => 07_system_fw}/src/syntax/tokens.rs (100%) rename {system_fw => 07_system_fw}/src/syntax/visit/mod.rs (100%) rename {system_fw => 07_system_fw}/src/syntax/visit/types.rs (100%) rename {system_fw => 07_system_fw}/src/terms.rs (100%) rename {system_fw => 07_system_fw}/src/typecheck.rs (100%) rename {system_fw => 07_system_fw}/src/types.rs (100%) rename {system_fw => 07_system_fw}/test.fw (100%) rename {bidir => x1_bidir}/Cargo.toml (100%) rename {bidir => x1_bidir}/src/helpers.rs (100%) rename {bidir => x1_bidir}/src/main.rs (100%) rename {dependent => x2_dependent}/Cargo.toml (100%) rename {dependent => x2_dependent}/src/main.rs (100%) diff --git a/arith/Cargo.toml b/01_arith/Cargo.toml similarity index 100% rename from arith/Cargo.toml rename to 01_arith/Cargo.toml diff --git a/arith/src/lexer.rs b/01_arith/src/lexer.rs similarity index 100% rename from arith/src/lexer.rs rename to 01_arith/src/lexer.rs diff --git a/arith/src/main.rs b/01_arith/src/main.rs similarity index 100% rename from arith/src/main.rs rename to 01_arith/src/main.rs diff --git a/arith/src/parser.rs b/01_arith/src/parser.rs similarity index 100% rename from arith/src/parser.rs rename to 01_arith/src/parser.rs diff --git a/lambda/Cargo.toml b/02_lambda/Cargo.toml similarity index 100% rename from lambda/Cargo.toml rename to 02_lambda/Cargo.toml diff --git a/lambda/src/context.rs b/02_lambda/src/context.rs similarity index 100% rename from lambda/src/context.rs rename to 02_lambda/src/context.rs diff --git a/lambda/src/lexer.rs b/02_lambda/src/lexer.rs similarity index 100% rename from lambda/src/lexer.rs rename to 02_lambda/src/lexer.rs diff --git a/lambda/src/main.rs b/02_lambda/src/main.rs similarity index 100% rename from lambda/src/main.rs rename to 02_lambda/src/main.rs diff --git a/lambda/src/parser.rs b/02_lambda/src/parser.rs similarity index 100% rename from lambda/src/parser.rs rename to 02_lambda/src/parser.rs diff --git a/typedarith/Cargo.toml b/03_typedarith/Cargo.toml similarity index 100% rename from typedarith/Cargo.toml rename to 03_typedarith/Cargo.toml diff --git a/typedarith/src/ast.rs b/03_typedarith/src/ast.rs similarity index 100% rename from typedarith/src/ast.rs rename to 03_typedarith/src/ast.rs diff --git a/typedarith/src/lexer.rs b/03_typedarith/src/lexer.rs similarity index 100% rename from typedarith/src/lexer.rs rename to 03_typedarith/src/lexer.rs diff --git a/typedarith/src/main.rs b/03_typedarith/src/main.rs similarity index 100% rename from typedarith/src/main.rs rename to 03_typedarith/src/main.rs diff --git a/typedarith/src/parser.rs b/03_typedarith/src/parser.rs similarity index 100% rename from typedarith/src/parser.rs rename to 03_typedarith/src/parser.rs diff --git a/stlc/.gitignore b/04_stlc/.gitignore similarity index 100% rename from stlc/.gitignore rename to 04_stlc/.gitignore diff --git a/stlc/Cargo.toml b/04_stlc/Cargo.toml similarity index 100% rename from stlc/Cargo.toml rename to 04_stlc/Cargo.toml diff --git a/stlc/src/eval.rs b/04_stlc/src/eval.rs similarity index 100% rename from stlc/src/eval.rs rename to 04_stlc/src/eval.rs diff --git a/stlc/src/lexer.rs b/04_stlc/src/lexer.rs similarity index 100% rename from stlc/src/lexer.rs rename to 04_stlc/src/lexer.rs diff --git a/stlc/src/main.rs b/04_stlc/src/main.rs similarity index 100% rename from stlc/src/main.rs rename to 04_stlc/src/main.rs diff --git a/stlc/src/parser.rs b/04_stlc/src/parser.rs similarity index 100% rename from stlc/src/parser.rs rename to 04_stlc/src/parser.rs diff --git a/stlc/src/term.rs b/04_stlc/src/term.rs similarity index 100% rename from stlc/src/term.rs rename to 04_stlc/src/term.rs diff --git a/stlc/src/typing.rs b/04_stlc/src/typing.rs similarity index 100% rename from stlc/src/typing.rs rename to 04_stlc/src/typing.rs diff --git a/stlc/src/visitor.rs b/04_stlc/src/visitor.rs similarity index 100% rename from stlc/src/visitor.rs rename to 04_stlc/src/visitor.rs diff --git a/recon/Cargo.toml b/05_recon/Cargo.toml similarity index 100% rename from recon/Cargo.toml rename to 05_recon/Cargo.toml diff --git a/recon/src/disjoint.rs b/05_recon/src/disjoint.rs similarity index 92% rename from recon/src/disjoint.rs rename to 05_recon/src/disjoint.rs index 07daf56..b4d3bdb 100644 --- a/recon/src/disjoint.rs +++ b/05_recon/src/disjoint.rs @@ -294,31 +294,3 @@ impl std::fmt::Debug for DisjointSet { writeln!(f, "}}") } } - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn it_works() { - let mut set = DisjointSet::new(); - - let a = set.singleton(10); - let b = set.singleton(12); - let c = set.singleton(14); - let d = set.singleton(29); - let e = set.singleton(1); - - set.union(|a, b| a, a, d); - set.union(|a, b| a, d, c); - set.union(|a, b| a, a, e); - - assert_eq!(set.find(a), &29); - assert_eq!(set.find(e), &29); - assert_eq!(set.find(c), &29); - assert_eq!(set.find(d), &29); - assert!(set.find(a) != set.find(b)); - - assert_eq!(set.components.get(), 2); - } -} diff --git a/recon/src/main.rs b/05_recon/src/main.rs similarity index 100% rename from recon/src/main.rs rename to 05_recon/src/main.rs diff --git a/recon/src/mutation/mod.rs b/05_recon/src/mutation/mod.rs similarity index 100% rename from recon/src/mutation/mod.rs rename to 05_recon/src/mutation/mod.rs diff --git a/recon/src/mutation/write_once.rs b/05_recon/src/mutation/write_once.rs similarity index 100% rename from recon/src/mutation/write_once.rs rename to 05_recon/src/mutation/write_once.rs diff --git a/recon/src/naive.rs b/05_recon/src/naive.rs similarity index 100% rename from recon/src/naive.rs rename to 05_recon/src/naive.rs diff --git a/recon/src/parser.rs b/05_recon/src/parser.rs similarity index 100% rename from recon/src/parser.rs rename to 05_recon/src/parser.rs diff --git a/recon/src/types.rs b/05_recon/src/types.rs similarity index 100% rename from recon/src/types.rs rename to 05_recon/src/types.rs diff --git a/system_f/Cargo.toml b/06_system_f/Cargo.toml similarity index 100% rename from system_f/Cargo.toml rename to 06_system_f/Cargo.toml diff --git a/system_f/README.md b/06_system_f/README.md similarity index 100% rename from system_f/README.md rename to 06_system_f/README.md diff --git a/system_f/src/diagnostics.rs b/06_system_f/src/diagnostics.rs similarity index 100% rename from system_f/src/diagnostics.rs rename to 06_system_f/src/diagnostics.rs diff --git a/system_f/src/eval.rs b/06_system_f/src/eval.rs similarity index 100% rename from system_f/src/eval.rs rename to 06_system_f/src/eval.rs diff --git a/system_f/src/macros.rs b/06_system_f/src/macros.rs similarity index 100% rename from system_f/src/macros.rs rename to 06_system_f/src/macros.rs diff --git a/system_f/src/main.rs b/06_system_f/src/main.rs similarity index 100% rename from system_f/src/main.rs rename to 06_system_f/src/main.rs diff --git a/system_f/src/patterns/mod.rs b/06_system_f/src/patterns/mod.rs similarity index 100% rename from system_f/src/patterns/mod.rs rename to 06_system_f/src/patterns/mod.rs diff --git a/system_f/src/syntax/lexer.rs b/06_system_f/src/syntax/lexer.rs similarity index 100% rename from system_f/src/syntax/lexer.rs rename to 06_system_f/src/syntax/lexer.rs diff --git a/system_f/src/syntax/mod.rs b/06_system_f/src/syntax/mod.rs similarity index 100% rename from system_f/src/syntax/mod.rs rename to 06_system_f/src/syntax/mod.rs diff --git a/system_f/src/syntax/parser.rs b/06_system_f/src/syntax/parser.rs similarity index 100% rename from system_f/src/syntax/parser.rs rename to 06_system_f/src/syntax/parser.rs diff --git a/system_f/src/terms/mod.rs b/06_system_f/src/terms/mod.rs similarity index 100% rename from system_f/src/terms/mod.rs rename to 06_system_f/src/terms/mod.rs diff --git a/system_f/src/terms/visit.rs b/06_system_f/src/terms/visit.rs similarity index 100% rename from system_f/src/terms/visit.rs rename to 06_system_f/src/terms/visit.rs diff --git a/system_f/src/types/mod.rs b/06_system_f/src/types/mod.rs similarity index 100% rename from system_f/src/types/mod.rs rename to 06_system_f/src/types/mod.rs diff --git a/system_f/src/types/patterns.rs b/06_system_f/src/types/patterns.rs similarity index 100% rename from system_f/src/types/patterns.rs rename to 06_system_f/src/types/patterns.rs diff --git a/system_f/src/types/visit.rs b/06_system_f/src/types/visit.rs similarity index 100% rename from system_f/src/types/visit.rs rename to 06_system_f/src/types/visit.rs diff --git a/system_f/src/visit.rs b/06_system_f/src/visit.rs similarity index 100% rename from system_f/src/visit.rs rename to 06_system_f/src/visit.rs diff --git a/system_f/test.sf b/06_system_f/test.sf similarity index 100% rename from system_f/test.sf rename to 06_system_f/test.sf diff --git a/system_fw/Cargo.toml b/07_system_fw/Cargo.toml similarity index 100% rename from system_fw/Cargo.toml rename to 07_system_fw/Cargo.toml diff --git a/system_fw/README.md b/07_system_fw/README.md similarity index 100% rename from system_fw/README.md rename to 07_system_fw/README.md diff --git a/system_fw/src/diagnostics.rs b/07_system_fw/src/diagnostics.rs similarity index 100% rename from system_fw/src/diagnostics.rs rename to 07_system_fw/src/diagnostics.rs diff --git a/system_fw/src/elaborate.rs b/07_system_fw/src/elaborate.rs similarity index 100% rename from system_fw/src/elaborate.rs rename to 07_system_fw/src/elaborate.rs diff --git a/system_fw/src/functor.rs b/07_system_fw/src/functor.rs similarity index 100% rename from system_fw/src/functor.rs rename to 07_system_fw/src/functor.rs diff --git a/system_fw/src/hir/bidir.rs b/07_system_fw/src/hir/bidir.rs similarity index 100% rename from system_fw/src/hir/bidir.rs rename to 07_system_fw/src/hir/bidir.rs diff --git a/system_fw/src/hir/mod.rs b/07_system_fw/src/hir/mod.rs similarity index 100% rename from system_fw/src/hir/mod.rs rename to 07_system_fw/src/hir/mod.rs diff --git a/system_fw/src/macros.rs b/07_system_fw/src/macros.rs similarity index 100% rename from system_fw/src/macros.rs rename to 07_system_fw/src/macros.rs diff --git a/system_fw/src/main.rs b/07_system_fw/src/main.rs similarity index 100% rename from system_fw/src/main.rs rename to 07_system_fw/src/main.rs diff --git a/system_fw/src/stack.rs b/07_system_fw/src/stack.rs similarity index 100% rename from system_fw/src/stack.rs rename to 07_system_fw/src/stack.rs diff --git a/system_fw/src/syntax/ast.rs b/07_system_fw/src/syntax/ast.rs similarity index 100% rename from system_fw/src/syntax/ast.rs rename to 07_system_fw/src/syntax/ast.rs diff --git a/system_fw/src/syntax/lexer.rs b/07_system_fw/src/syntax/lexer.rs similarity index 100% rename from system_fw/src/syntax/lexer.rs rename to 07_system_fw/src/syntax/lexer.rs diff --git a/system_fw/src/syntax/mod.rs b/07_system_fw/src/syntax/mod.rs similarity index 100% rename from system_fw/src/syntax/mod.rs rename to 07_system_fw/src/syntax/mod.rs diff --git a/system_fw/src/syntax/parser/README.md b/07_system_fw/src/syntax/parser/README.md similarity index 100% rename from system_fw/src/syntax/parser/README.md rename to 07_system_fw/src/syntax/parser/README.md diff --git a/system_fw/src/syntax/parser/decls.rs b/07_system_fw/src/syntax/parser/decls.rs similarity index 100% rename from system_fw/src/syntax/parser/decls.rs rename to 07_system_fw/src/syntax/parser/decls.rs diff --git a/system_fw/src/syntax/parser/exprs.rs b/07_system_fw/src/syntax/parser/exprs.rs similarity index 100% rename from system_fw/src/syntax/parser/exprs.rs rename to 07_system_fw/src/syntax/parser/exprs.rs diff --git a/system_fw/src/syntax/parser/infix.rs b/07_system_fw/src/syntax/parser/infix.rs similarity index 100% rename from system_fw/src/syntax/parser/infix.rs rename to 07_system_fw/src/syntax/parser/infix.rs diff --git a/system_fw/src/syntax/parser/mod.rs b/07_system_fw/src/syntax/parser/mod.rs similarity index 100% rename from system_fw/src/syntax/parser/mod.rs rename to 07_system_fw/src/syntax/parser/mod.rs diff --git a/system_fw/src/syntax/parser/patterns.rs b/07_system_fw/src/syntax/parser/patterns.rs similarity index 100% rename from system_fw/src/syntax/parser/patterns.rs rename to 07_system_fw/src/syntax/parser/patterns.rs diff --git a/system_fw/src/syntax/parser/types.rs b/07_system_fw/src/syntax/parser/types.rs similarity index 100% rename from system_fw/src/syntax/parser/types.rs rename to 07_system_fw/src/syntax/parser/types.rs diff --git a/system_fw/src/syntax/tokens.rs b/07_system_fw/src/syntax/tokens.rs similarity index 100% rename from system_fw/src/syntax/tokens.rs rename to 07_system_fw/src/syntax/tokens.rs diff --git a/system_fw/src/syntax/visit/mod.rs b/07_system_fw/src/syntax/visit/mod.rs similarity index 100% rename from system_fw/src/syntax/visit/mod.rs rename to 07_system_fw/src/syntax/visit/mod.rs diff --git a/system_fw/src/syntax/visit/types.rs b/07_system_fw/src/syntax/visit/types.rs similarity index 100% rename from system_fw/src/syntax/visit/types.rs rename to 07_system_fw/src/syntax/visit/types.rs diff --git a/system_fw/src/terms.rs b/07_system_fw/src/terms.rs similarity index 100% rename from system_fw/src/terms.rs rename to 07_system_fw/src/terms.rs diff --git a/system_fw/src/typecheck.rs b/07_system_fw/src/typecheck.rs similarity index 100% rename from system_fw/src/typecheck.rs rename to 07_system_fw/src/typecheck.rs diff --git a/system_fw/src/types.rs b/07_system_fw/src/types.rs similarity index 100% rename from system_fw/src/types.rs rename to 07_system_fw/src/types.rs diff --git a/system_fw/test.fw b/07_system_fw/test.fw similarity index 100% rename from system_fw/test.fw rename to 07_system_fw/test.fw diff --git a/Cargo.toml b/Cargo.toml index 01fda92..14e0bb5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,2 +1,2 @@ [workspace] -members = ["arith", "bidir", "dependent", "lambda", "typedarith", "stlc", "system_f", "system_fw", "recon", "util"] \ No newline at end of file +members = ["01_arith", "02_lambda", "03_typedarith", "04_stlc", "05_recon", "06_system_f", "07_system_fw", "x1_bidir", "x2_dependent", "util"] \ No newline at end of file diff --git a/README.md b/README.md index c7b6ac9..b20b254 100644 --- a/README.md +++ b/README.md @@ -4,29 +4,21 @@ Several Rust implementations of exercises from Benjamin Pierce's "Types and Programming Languages" are organized into different folders, as described below: -- `lambda` is an implementation of the untyped lambda calculus as presented in chapter 5, 6, and 7. - - `arith` is an implementation of the untyped lambda calculus extended with simple numeric operations +- `lambda` is an implementation of the untyped lambda calculus as presented in chapter 5, 6, and 7. + - `typedarith` is the `arith` project extended with simple types: `Nat` and `Bool` - `stlc` is an implementation of the simply typed lambda calculus, as discussed in chapters 9 and 10 of TAPL. This simply typed calculus has the types, `Unit`, `Nat`, `Bool`, `T -> T` (arrow), and `Record` types. -- `system_f` contains a parser, typechecker, and evaluator for the simply typed lambda calculus with parametric polymorphism (System F). +- `recon` contains several implementations of Hindley-Milner based type reconstruction from the untyped lambda calculus to System F, with let-polymorphism. Both Algorithm W (the more common) and Algorithm J (the more efficient) are presented. For Alg. W, both a naive equality constraint solver, and a faster union-find (with path compression) solver are provided. Algorithm J makes use shared mutable references to promote type sharing instead. -The implementation of System F is the most complete so far, and I've tried to write a parser, typechecker and diagnostic system that can given meaningful messages, such as: +- `system_f` contains a parser, typechecker, and evaluator for the simply typed lambda calculus with parametric polymorphism (System F). The implementation of System F is the most complete so far, and I've tried to write a parser, typechecker and diagnostic system that can given meaningful messages -``` -type Var = { A | B Nat | C Nat } -let func = (\x: Var. case x of | A => 0 | B y => succ x | C y => pred x) in func C 2 of Var - ^~~~^ --- abstraction requires type Nat - ^^ --- but it is applied to type "A: Unit | B: Nat | C: Nat" -``` +- `system_fw` contains a parser for a high-level, Standard ML like source language that is desugared into an HIR, and then System F-omega. This extends `system_f` with type operators and higher-kinded types. This is where most of the ongoing work is located, as I'd like to make this the basis of a toy (but powerful, and useable) programming language. Ideally we will have some form of bidirectional type inference. Work on this has accidentally turned into a full fledged [SML compiler](https://github.com/SomewhatML/sml-compiler), so it's likely that I will roll back the work on the system_fw project to just type checking -- `system_fw` contains a parser for a high-level, Standard ML like source language that is desugared into an HIR, and then System F-omega. This extends `system_f` with type operators and higher-kinded types. This is where most of the ongoing work is located, as I'd like to make this the basis of a toy (but powerful, and useable) programming language. Ideally we will have some form of bidirectional type inference +- `bidir` is is an implementation of the bidirectional typechecker from 'Complete and Easy Bidirectional Typechecking', extended with booleans, product, and sum types. I make no claims on the correctness of the implementation for the extended features not present in the paper. - `dependent` is WIP, implementing a simple, dependently typed lambda calculus as discussed in ATAPL. -- `bidir` is is an implementation of the bidirectional typechecker from 'Complete and Easy Bidirectional Typechecking', extended with booleans, product, and sum types. I make no claims on the correctness of the implementation for the extended features not present in the paper. - -- `recon` contains several implementations of Hindley-Milner based type reconstruction from the untyped lambda calculus to System F, with let-polymorphism. Both Algorithm W (the more common) and Algorithm J (the more efficient) are presented. For Alg. W, both a naive equality constraint solver, and a faster union-find (with path compression) solver are provided. Algorithm J makes use shared mutable references to promote type sharing instead. diff --git a/bidir/Cargo.toml b/x1_bidir/Cargo.toml similarity index 100% rename from bidir/Cargo.toml rename to x1_bidir/Cargo.toml diff --git a/bidir/src/helpers.rs b/x1_bidir/src/helpers.rs similarity index 100% rename from bidir/src/helpers.rs rename to x1_bidir/src/helpers.rs diff --git a/bidir/src/main.rs b/x1_bidir/src/main.rs similarity index 100% rename from bidir/src/main.rs rename to x1_bidir/src/main.rs diff --git a/dependent/Cargo.toml b/x2_dependent/Cargo.toml similarity index 100% rename from dependent/Cargo.toml rename to x2_dependent/Cargo.toml diff --git a/dependent/src/main.rs b/x2_dependent/src/main.rs similarity index 100% rename from dependent/src/main.rs rename to x2_dependent/src/main.rs