├── .editorconfig ├── .gitattributes ├── .github └── workflows │ └── ci.yml ├── .gitignore ├── .vscode └── extensions.json ├── CODE_OF_CONDUCT.md ├── Cargo.lock ├── Cargo.toml ├── LICENSE ├── README.md ├── doc ├── README.md ├── background.md ├── reference.md └── roadmap.md ├── experiments ├── README.md ├── lean │ ├── .gitignore │ ├── README.md │ ├── leanpkg.toml │ └── src │ │ └── ddl │ │ ├── basic.lean │ │ ├── binary │ │ ├── basic.lean │ │ ├── default.lean │ │ ├── formation.lean │ │ ├── kinding.lean │ │ ├── monad.lean │ │ ├── repr.lean │ │ └── subst.lean │ │ ├── binder.lean │ │ ├── ctx.lean │ │ ├── default.lean │ │ ├── embed.lean │ │ ├── host │ │ ├── basic.lean │ │ ├── default.lean │ │ ├── evaluation.lean │ │ ├── formation.lean │ │ ├── lemmas.lean │ │ └── typing.lean │ │ └── parsing.lean ├── makam-spec │ ├── README.md │ ├── package.json │ ├── src │ │ ├── init.makam │ │ ├── lang │ │ │ ├── core │ │ │ │ ├── base.makam │ │ │ │ ├── binary.makam │ │ │ │ ├── init.makam │ │ │ │ ├── semantics.makam │ │ │ │ └── typing.makam │ │ │ ├── init.makam │ │ │ ├── rust.makam │ │ │ ├── stratified.makam │ │ │ ├── surface.makam │ │ │ ├── uncurried.makam │ │ │ └── unkinded.makam │ │ ├── pass │ │ │ ├── core_to_stratified.makam │ │ │ ├── core_to_surface.makam │ │ │ ├── init.makam │ │ │ ├── stratified_to_unkinded.makam │ │ │ ├── surface_to_core.makam │ │ │ ├── uncurried_to_rust.makam │ │ │ └── unkinded_to_uncurried.makam │ │ └── stdlib.makam │ └── test │ │ ├── init.makam │ │ ├── lang │ │ ├── core │ │ │ ├── init.makam │ │ │ ├── semantics.makam │ │ │ └── typing.makam │ │ └── init.makam │ │ └── pass │ │ ├── core_to_stratified.makam │ │ ├── init.makam │ │ └── surface_to_core.makam ├── mercury-prototype │ ├── .gitignore │ ├── abort.m │ ├── bytes.m │ ├── ddl.m │ ├── ddl │ │ ├── elf.ddl │ │ ├── icc2.ddl │ │ ├── opentype.ddl │ │ └── png.ddl │ ├── doc │ │ └── SPEC.md │ ├── dump.m │ ├── main.m │ └── parse.m ├── prolog-prototype │ ├── README.md │ ├── dl.html │ ├── src │ │ ├── dl-1.pl │ │ ├── dl-full.pl │ │ ├── examples.pl │ │ ├── harness.pl │ │ ├── load.pl │ │ └── util.pl │ └── test_data │ │ ├── ascii-1.txt │ │ ├── sudoku1-1.bin │ │ ├── sudoku2-1.bin │ │ ├── sudoku3-1.bin │ │ ├── sudoku4-1.bin │ │ ├── sudoku5-1.bin │ │ ├── tree-1.bin │ │ ├── xy_z-1.bin │ │ ├── xy_z-2.bin │ │ ├── xy_z-3.bin │ │ ├── xyz-1.bin │ │ ├── xyz-2.bin │ │ └── xyz-3.bin ├── rust-prototype-v1 │ ├── .gitignore │ ├── Cargo.toml │ ├── book │ │ ├── .gitignore │ │ ├── README.md │ │ ├── book.toml │ │ └── src │ │ │ ├── SUMMARY.md │ │ │ ├── appendix.md │ │ │ ├── appendix │ │ │ └── alignment.md │ │ │ ├── chapter_1.md │ │ │ └── specification.md │ ├── build.rs │ ├── ddl-util │ │ ├── Cargo.toml │ │ └── src │ │ │ └── lib.rs │ ├── examples │ │ ├── features │ │ │ ├── README.md │ │ │ └── type-params │ │ │ │ ├── Cargo.toml │ │ │ │ ├── build.rs │ │ │ │ └── src │ │ │ │ ├── lib.rs │ │ │ │ └── pair.ddl │ │ └── formats │ │ │ ├── README.md │ │ │ ├── bitmap │ │ │ ├── Cargo.toml │ │ │ ├── build.rs │ │ │ └── src │ │ │ │ ├── bitmap.ddl │ │ │ │ └── lib.rs │ │ │ ├── bson │ │ │ ├── Cargo.toml │ │ │ ├── build.rs │ │ │ └── src │ │ │ │ ├── bson.ddl │ │ │ │ └── lib.rs │ │ │ ├── edid │ │ │ ├── Cargo.toml │ │ │ ├── build.rs │ │ │ ├── src │ │ │ │ ├── edid.ddl │ │ │ │ └── lib.rs │ │ │ └── tests │ │ │ │ ├── fixtures │ │ │ │ ├── README.md │ │ │ │ ├── mbp_2013_built_in_retina.bin │ │ │ │ ├── mbp_2017_built_in_retina.bin │ │ │ │ └── yamakasi_0270led.bin │ │ │ │ └── parse.rs │ │ │ ├── object_id │ │ │ ├── Cargo.toml │ │ │ ├── build.rs │ │ │ ├── src │ │ │ │ ├── lib.rs │ │ │ │ └── object_id.ddl │ │ │ └── tests │ │ │ │ └── parse.rs │ │ │ └── stl │ │ │ ├── Cargo.toml │ │ │ ├── build.rs │ │ │ ├── src │ │ │ ├── lib.rs │ │ │ └── stl.ddl │ │ │ └── tests │ │ │ ├── fixtures │ │ │ ├── LICENCE │ │ │ ├── beethoven.stl │ │ │ └── cube.stl │ │ │ └── parse.rs │ ├── src │ │ ├── compile │ │ │ ├── codegen.rs │ │ │ ├── ir.rs │ │ │ ├── lower.rs │ │ │ └── mod.rs │ │ ├── lib.rs │ │ ├── name.rs │ │ ├── semantics │ │ │ ├── errors.rs │ │ │ ├── mod.rs │ │ │ └── tests.rs │ │ ├── syntax │ │ │ ├── concrete.rs │ │ │ ├── core.rs │ │ │ ├── mod.rs │ │ │ ├── parse │ │ │ │ ├── errors.rs │ │ │ │ ├── grammar.lalrpop │ │ │ │ ├── grammar.rs │ │ │ │ ├── lexer.rs │ │ │ │ ├── mod.rs │ │ │ │ ├── snapshots │ │ │ │ │ ├── tests.parse_add_expr.snap │ │ │ │ │ ├── tests.parse_add_expr_mixed.snap │ │ │ │ │ ├── tests.parse_array_with_constant_size.snap │ │ │ │ │ ├── tests.parse_definition.snap │ │ │ │ │ ├── tests.parse_div_expr.snap │ │ │ │ │ ├── tests.parse_expr_bool_atomic.snap │ │ │ │ │ ├── tests.parse_expr_bool_operators.snap │ │ │ │ │ ├── tests.parse_mixed_arithmetic_expr.snap │ │ │ │ │ ├── tests.parse_mixed_arithmetic_expr_parenthesized.snap │ │ │ │ │ ├── tests.parse_mul_expr.snap │ │ │ │ │ ├── tests.parse_mul_expr_mixed.snap │ │ │ │ │ ├── tests.parse_proj_expr.snap │ │ │ │ │ ├── tests.parse_simple_definition.snap │ │ │ │ │ ├── tests.parse_sub_expr.snap │ │ │ │ │ ├── tests.parse_subscript_expr.snap │ │ │ │ │ ├── tests.parse_ty_array_dependent.snap │ │ │ │ │ ├── tests.parse_ty_assert.snap │ │ │ │ │ ├── tests.parse_ty_empty_struct.snap │ │ │ │ │ ├── tests.parse_ty_var.snap │ │ │ │ │ └── tests.parse_type_params.snap │ │ │ │ └── tests.rs │ │ │ ├── snapshots │ │ │ │ ├── core.ty_abs_complex.snap │ │ │ │ ├── core.ty_abs_id.snap │ │ │ │ ├── core.ty_abs_k_combinator.snap │ │ │ │ └── core.ty_abs_s_combinator.snap │ │ │ └── translation │ │ │ │ ├── concrete_to_core.rs │ │ │ │ └── mod.rs │ │ ├── test.rs │ │ └── var.rs │ └── tests │ │ ├── examples.rs │ │ └── snapshots │ │ ├── examples.bitmap_codegen.snap │ │ ├── examples.bitmap_ir.snap │ │ ├── examples.bitmap_module.snap │ │ ├── examples.bson_codegen.snap │ │ ├── examples.bson_ir.snap │ │ ├── examples.bson_module.snap │ │ ├── examples.edid_codegen.snap │ │ ├── examples.edid_ir.snap │ │ ├── examples.edid_module.snap │ │ ├── examples.object_id_codegen.snap │ │ ├── examples.object_id_ir.snap │ │ ├── examples.object_id_module.snap │ │ ├── examples.stl_codegen.snap │ │ ├── examples.stl_ir.snap │ │ └── examples.stl_module.snap ├── rust-prototype-v2 │ ├── .gitignore │ ├── .gitmodules │ ├── .travis.yml │ ├── CODE_OF_CONDUCT.md │ ├── Cargo.toml │ ├── LICENSE │ ├── README.md │ ├── assets │ │ └── yeslogic-logo.png │ ├── book │ │ ├── .gitignore │ │ ├── README.md │ │ ├── book.toml │ │ └── src │ │ │ ├── SUMMARY.md │ │ │ ├── appendix │ │ │ ├── index.md │ │ │ ├── influences.md │ │ │ ├── references.md │ │ │ └── theory.md │ │ │ ├── index.md │ │ │ ├── installation │ │ │ └── index.md │ │ │ └── language │ │ │ └── index.md │ ├── build.rs │ ├── ci │ │ ├── build-book │ │ ├── build-highlight-js │ │ └── install-cargo-updates │ ├── rustfmt.toml │ ├── src │ │ ├── cli │ │ │ ├── check.rs │ │ │ ├── mod.rs │ │ │ └── repl.rs │ │ ├── lib.rs │ │ ├── main.rs │ │ ├── semantics │ │ │ ├── context.rs │ │ │ ├── errors.rs │ │ │ ├── mod.rs │ │ │ ├── normalize.rs │ │ │ └── parser.rs │ │ └── syntax │ │ │ ├── concrete.rs │ │ │ ├── core.rs │ │ │ ├── mod.rs │ │ │ ├── parse │ │ │ ├── errors.rs │ │ │ ├── grammar.lalrpop │ │ │ ├── lexer.rs │ │ │ └── mod.rs │ │ │ ├── pretty │ │ │ ├── concrete.rs │ │ │ ├── core.rs │ │ │ └── mod.rs │ │ │ ├── raw.rs │ │ │ └── translation │ │ │ ├── desugar.rs │ │ │ ├── mod.rs │ │ │ └── resugar.rs │ └── tests │ │ ├── check_module.rs │ │ ├── check_term.rs │ │ ├── desugar.rs │ │ ├── fixtures │ │ ├── bitmap_flat.ddl │ │ ├── bitmap_nested.ddl │ │ ├── gif.ddl │ │ └── opentype.ddl │ │ ├── goldenfiles │ │ ├── ann │ │ ├── ann_ann_ann │ │ ├── ann_ann_left │ │ ├── ann_ann_right │ │ ├── ty │ │ └── ty_level │ │ ├── infer_term.rs │ │ ├── normalize.rs │ │ ├── parse.rs │ │ ├── parser.rs │ │ ├── resugar.rs │ │ ├── subtype.rs │ │ └── support │ │ └── mod.rs └── rust-prototype-v3 │ ├── Cargo.toml │ ├── LICENSE │ ├── README.md │ ├── book │ ├── .gitignore │ ├── README.md │ ├── book.toml │ ├── index.js │ ├── package.json │ ├── src │ │ ├── SUMMARY.md │ │ ├── background.md │ │ ├── development │ │ │ ├── code-of-conduct.md │ │ │ └── contributing.md │ │ ├── guide.md │ │ ├── guide │ │ │ └── first-format.md │ │ ├── index.md │ │ ├── reference.md │ │ ├── reference │ │ │ ├── enumerations.md │ │ │ ├── format-descriptions.md │ │ │ ├── lexical-syntax.md │ │ │ ├── sequences.md │ │ │ ├── sorts.md │ │ │ └── structs.md │ │ ├── specification.md │ │ └── specification │ │ │ ├── textual-representation.md │ │ │ └── textual-representation │ │ │ ├── concrete-syntax.md │ │ │ └── lexical-syntax.md │ └── theme │ │ └── highlight.js │ ├── examples │ ├── data │ │ └── stl │ │ │ └── cube.stl │ ├── edid.fathom │ ├── gif.fathom │ ├── icns.fathom │ ├── ico.fathom │ ├── opentype.fathom │ └── stl.fathom │ ├── fathom-cli │ ├── Cargo.toml │ ├── src │ │ ├── commands.rs │ │ ├── commands │ │ │ ├── check.rs │ │ │ ├── compile.rs │ │ │ ├── data.rs │ │ │ └── doc.rs │ │ ├── lib.rs │ │ └── main.rs │ └── tests │ │ ├── cli │ │ ├── check.rs │ │ ├── compile.rs │ │ ├── data.rs │ │ ├── doc.rs │ │ └── lib.rs │ │ └── source_tests.rs │ ├── fathom-runtime │ ├── Cargo.toml │ └── src │ │ ├── lib.rs │ │ ├── read.rs │ │ └── write.rs │ ├── fathom-test-util │ ├── Cargo.toml │ └── src │ │ └── lib.rs │ ├── fathom-test │ ├── Cargo.toml │ └── src │ │ ├── directives │ │ ├── lexer.rs │ │ ├── mod.rs │ │ └── parser.rs │ │ ├── lib.rs │ │ └── snapshot.rs │ ├── fathom │ ├── Cargo.toml │ ├── build.rs │ └── src │ │ ├── driver.rs │ │ ├── ieee754.rs │ │ ├── lang.rs │ │ ├── lang │ │ ├── core.rs │ │ ├── core │ │ │ ├── binary.rs │ │ │ ├── binary │ │ │ │ └── read.rs │ │ │ ├── grammar.lalrpop │ │ │ ├── lexer.rs │ │ │ ├── semantics.rs │ │ │ └── typing.rs │ │ ├── surface.rs │ │ └── surface │ │ │ ├── grammar.lalrpop │ │ │ └── lexer.rs │ │ ├── lib.rs │ │ ├── literal.rs │ │ ├── pass.rs │ │ ├── pass │ │ ├── core_to_pretty.rs │ │ ├── core_to_surface.rs │ │ ├── surface_to_core.rs │ │ ├── surface_to_doc.rs │ │ ├── surface_to_doc │ │ │ ├── minireset.min.css │ │ │ └── style.css │ │ └── surface_to_pretty.rs │ │ └── reporting.rs │ └── tests │ ├── constant │ ├── fail_ann_mismatch.fathom │ ├── fail_format_array_bad_elem.fathom │ ├── fail_format_array_bad_len.fathom │ ├── fail_if_else_term_mismatched_arms.fathom │ ├── fail_if_else_term_mismatched_condition.fathom │ ├── fail_kind_has_no_type.fathom │ ├── fail_literals.fathom │ ├── fail_match_ambiguous_scrutinee.fathom │ ├── fail_match_int_ambiguous.fathom │ ├── fail_match_int_missing_default.fathom │ ├── fail_match_int_term_mismatched_arms.fathom │ ├── fail_numeric_literal_ambiguous.fathom │ ├── fail_numeric_literal_not_supported.fathom │ ├── pass_ann.fathom │ ├── pass_ann_ann.fathom │ ├── pass_ann_sugar.fathom │ ├── pass_constant_term.fathom │ ├── pass_constant_type.fathom │ ├── pass_format_array.fathom │ ├── pass_format_array.rs │ ├── pass_function_types.fathom │ ├── pass_globals.fathom │ ├── pass_if_else_ann_type.fathom │ ├── pass_if_else_format_type.fathom │ ├── pass_if_else_format_type.rs │ ├── pass_if_else_format_type_item.fathom │ ├── pass_if_else_format_type_item.rs │ ├── pass_if_else_host_type.fathom │ ├── pass_if_else_host_type_item.fathom │ ├── pass_if_else_if_else_format_type.fathom │ ├── pass_if_else_term.fathom │ ├── pass_if_else_term_item.fathom │ ├── pass_literals.fathom │ ├── pass_match_int_ann_type.fathom │ ├── pass_match_int_format_type.fathom │ ├── pass_match_int_format_type.rs │ ├── pass_match_int_format_type_item.fathom │ ├── pass_match_int_format_type_item.rs │ ├── pass_match_int_host_type.fathom │ ├── pass_match_int_host_type_item.fathom │ ├── pass_match_int_term.fathom │ ├── pass_match_int_term_item.fathom │ ├── pass_match_int_term_unreachable.fathom │ ├── pass_simple.fathom │ ├── pass_simple.rs │ ├── pass_simple_doc.fathom │ ├── repr.fathom │ ├── sequence_term.fathom │ └── snapshots │ │ ├── fail_ann_mismatch.core.fathom │ │ ├── fail_ann_mismatch.html │ │ ├── fail_format_array_bad_elem.core.fathom │ │ ├── fail_format_array_bad_elem.html │ │ ├── fail_format_array_bad_len.core.fathom │ │ ├── fail_format_array_bad_len.html │ │ ├── fail_if_else_term_mismatched_arms.core.fathom │ │ ├── fail_if_else_term_mismatched_arms.html │ │ ├── fail_if_else_term_mismatched_condition.core.fathom │ │ ├── fail_if_else_term_mismatched_condition.html │ │ ├── fail_kind_has_no_type.core.fathom │ │ ├── fail_kind_has_no_type.html │ │ ├── fail_literals.core.fathom │ │ ├── fail_literals.html │ │ ├── fail_match_ambiguous_scrutinee.core.fathom │ │ ├── fail_match_ambiguous_scrutinee.html │ │ ├── fail_match_int_ambiguous.core.fathom │ │ ├── fail_match_int_ambiguous.html │ │ ├── fail_match_int_missing_default.core.fathom │ │ ├── fail_match_int_missing_default.html │ │ ├── fail_match_int_term_mismatched_arms.core.fathom │ │ ├── fail_match_int_term_mismatched_arms.html │ │ ├── fail_numeric_literal_ambiguous.core.fathom │ │ ├── fail_numeric_literal_ambiguous.html │ │ ├── fail_numeric_literal_not_supported.core.fathom │ │ ├── fail_numeric_literal_not_supported.html │ │ ├── pass_ann.core.fathom │ │ ├── pass_ann.html │ │ ├── pass_ann_ann.core.fathom │ │ ├── pass_ann_ann.html │ │ ├── pass_ann_sugar.core.fathom │ │ ├── pass_ann_sugar.html │ │ ├── pass_constant_term.core.fathom │ │ ├── pass_constant_term.html │ │ ├── pass_constant_type.core.fathom │ │ ├── pass_constant_type.html │ │ ├── pass_format_array.core.fathom │ │ ├── pass_format_array.html │ │ ├── pass_function_types.core.fathom │ │ ├── pass_function_types.html │ │ ├── pass_globals.core.fathom │ │ ├── pass_globals.html │ │ ├── pass_if_else_ann_type.core.fathom │ │ ├── pass_if_else_ann_type.html │ │ ├── pass_if_else_format_type.core.fathom │ │ ├── pass_if_else_format_type.html │ │ ├── pass_if_else_format_type_item.core.fathom │ │ ├── pass_if_else_format_type_item.html │ │ ├── pass_if_else_host_type.core.fathom │ │ ├── pass_if_else_host_type.html │ │ ├── pass_if_else_host_type_item.core.fathom │ │ ├── pass_if_else_host_type_item.html │ │ ├── pass_if_else_if_else_format_type.core.fathom │ │ ├── pass_if_else_if_else_format_type.html │ │ ├── pass_if_else_term.core.fathom │ │ ├── pass_if_else_term.html │ │ ├── pass_if_else_term_item.core.fathom │ │ ├── pass_if_else_term_item.html │ │ ├── pass_literals.core.fathom │ │ ├── pass_literals.html │ │ ├── pass_match_int_ann_type.core.fathom │ │ ├── pass_match_int_ann_type.html │ │ ├── pass_match_int_format_type.core.fathom │ │ ├── pass_match_int_format_type.html │ │ ├── pass_match_int_format_type_item.core.fathom │ │ ├── pass_match_int_format_type_item.html │ │ ├── pass_match_int_host_type.core.fathom │ │ ├── pass_match_int_host_type.html │ │ ├── pass_match_int_host_type_item.core.fathom │ │ ├── pass_match_int_host_type_item.html │ │ ├── pass_match_int_term.core.fathom │ │ ├── pass_match_int_term.html │ │ ├── pass_match_int_term_item.core.fathom │ │ ├── pass_match_int_term_item.html │ │ ├── pass_match_int_term_unreachable.core.fathom │ │ ├── pass_match_int_term_unreachable.html │ │ ├── pass_simple.core.fathom │ │ ├── pass_simple.html │ │ ├── pass_simple_doc.core.fathom │ │ ├── pass_simple_doc.html │ │ ├── repr.core.fathom │ │ ├── repr.html │ │ ├── sequence_term.core.fathom │ │ └── sequence_term.html │ ├── fail_duplicate_definitions.fathom │ ├── fail_invalid_token.fathom │ ├── fail_unexpected_token.fathom │ ├── pass_empty.fathom │ ├── pass_empty_doc.fathom │ ├── snapshots │ ├── fail_duplicate_definitions.core.fathom │ ├── fail_duplicate_definitions.html │ ├── fail_invalid_token.core.fathom │ ├── fail_invalid_token.html │ ├── fail_unexpected_token.core.fathom │ ├── fail_unexpected_token.html │ ├── pass_empty.core.fathom │ ├── pass_empty.html │ ├── pass_empty_doc.core.fathom │ └── pass_empty_doc.html │ └── struct │ ├── dependent_fields.fathom │ ├── dependent_fields.rs │ ├── fail_duplicate_fields.fathom │ ├── fail_field_type_mismatch.fathom │ ├── fail_invalid_ann.fathom │ ├── fail_missing_ann.fathom │ ├── fail_missing_closing_brace.fathom │ ├── fail_missing_fields.fathom │ ├── fail_missing_name.fathom │ ├── fail_undefined_field.fathom │ ├── parameters.fathom │ ├── pass_empty.fathom │ ├── pass_empty.rs │ ├── pass_empty_doc.fathom │ ├── pass_pair.fathom │ ├── pass_pair.rs │ ├── pass_singleton.fathom │ ├── pass_singleton.rs │ ├── pass_var.fathom │ ├── positions.fathom │ ├── positions.rs │ ├── snapshots │ ├── dependent_fields.core.fathom │ ├── dependent_fields.html │ ├── fail_duplicate_fields.core.fathom │ ├── fail_duplicate_fields.html │ ├── fail_field_type_mismatch.core.fathom │ ├── fail_field_type_mismatch.html │ ├── fail_invalid_ann.core.fathom │ ├── fail_invalid_ann.html │ ├── fail_missing_ann.core.fathom │ ├── fail_missing_ann.html │ ├── fail_missing_closing_brace.core.fathom │ ├── fail_missing_closing_brace.html │ ├── fail_missing_fields.core.fathom │ ├── fail_missing_fields.html │ ├── fail_missing_name.core.fathom │ ├── fail_missing_name.html │ ├── fail_undefined_field.core.fathom │ ├── fail_undefined_field.html │ ├── parameters.core.fathom │ ├── parameters.html │ ├── pass_empty.core.fathom │ ├── pass_empty.html │ ├── pass_empty_doc.core.fathom │ ├── pass_empty_doc.html │ ├── pass_pair.core.fathom │ ├── pass_pair.html │ ├── pass_singleton.core.fathom │ ├── pass_singleton.html │ ├── pass_var.core.fathom │ ├── pass_var.html │ ├── positions.core.fathom │ ├── positions.html │ ├── struct_compute.core.fathom │ ├── struct_compute.html │ ├── struct_elim.core.fathom │ ├── struct_elim.html │ ├── struct_term.core.fathom │ └── struct_term.html │ ├── struct_compute.fathom │ ├── struct_elim.fathom │ └── struct_term.fathom ├── fathom ├── Cargo.toml ├── build.rs ├── src │ ├── alloc.rs │ ├── core.rs │ ├── core │ │ ├── binary.rs │ │ ├── pretty.rs │ │ ├── prim.rs │ │ └── semantics.rs │ ├── driver.rs │ ├── env.rs │ ├── files.rs │ ├── lib.rs │ ├── main.rs │ ├── source.rs │ ├── surface.rs │ ├── surface │ │ ├── distillation.rs │ │ ├── elaboration.rs │ │ ├── elaboration │ │ │ ├── order.rs │ │ │ ├── reporting.rs │ │ │ └── unification.rs │ │ ├── grammar.lalrpop │ │ ├── lexer.rs │ │ └── pretty.rs │ └── symbol.rs └── tests │ ├── cli_tests.rs │ └── source_tests.rs ├── flake.lock ├── flake.nix ├── formats ├── README.md ├── data │ ├── edid │ │ ├── dell-P2415Q.edid │ │ ├── dell-P2415Q.snap │ │ └── invalid │ │ │ ├── wrong-magic.edid │ │ │ └── wrong-magic.snap │ ├── opentype │ │ ├── aots │ │ │ ├── README.md │ │ │ ├── cmap0_font1.otf │ │ │ ├── cmap0_font1.snap │ │ │ ├── cmap10_font1.otf │ │ │ ├── cmap10_font1.snap │ │ │ ├── cmap10_font2.otf │ │ │ ├── cmap10_font2.snap │ │ │ ├── cmap12_font1.otf │ │ │ ├── cmap12_font1.snap │ │ │ ├── cmap14_font1.otf │ │ │ ├── cmap14_font1.snap │ │ │ ├── cmap2_font1.otf │ │ │ ├── cmap2_font1.snap │ │ │ ├── cmap4_font1.otf │ │ │ ├── cmap4_font1.snap │ │ │ ├── cmap4_font2.otf │ │ │ ├── cmap4_font2.snap │ │ │ ├── cmap4_font3.otf │ │ │ ├── cmap4_font3.snap │ │ │ ├── cmap4_font4.otf │ │ │ ├── cmap4_font4.snap │ │ │ ├── cmap6_font1.otf │ │ │ ├── cmap6_font1.snap │ │ │ ├── cmap6_font2.otf │ │ │ ├── cmap6_font2.snap │ │ │ ├── cmap8_font1.otf │ │ │ └── cmap8_font1.snap │ │ ├── woff │ │ │ ├── README.md │ │ │ ├── valid-001.snap │ │ │ ├── valid-001.ttf │ │ │ ├── valid-005.snap │ │ │ └── valid-005.ttf │ │ └── woff2 │ │ │ ├── README.md │ │ │ ├── SFNT-TTF-Composite.snap │ │ │ └── SFNT-TTF-Composite.ttf │ └── stl-binary │ │ ├── cube.snap │ │ └── cube.stl ├── edid.fathom ├── edid.snap ├── gif.fathom ├── gif.snap ├── icns.fathom ├── icns.snap ├── ideas │ ├── ico.fathom │ └── opentype │ │ └── morx.fathom ├── image.fathom ├── image.snap ├── object-id.fathom ├── object-id.snap ├── opentype.fathom ├── opentype.snap ├── stl-binary.fathom ├── stl-binary.snap ├── unwrap-none.fathom └── unwrap-none.snap ├── package.json ├── rustfmt.toml ├── tests ├── README.md ├── cmd │ ├── README.md │ ├── fathom-data.md │ ├── fathom-elab.md │ ├── fathom-norm.md │ └── fathom.md ├── fail │ ├── elaboration │ │ ├── ambiguous-array-literal.fathom │ │ ├── ambiguous-array-literal.snap │ │ ├── array-literal-not-supported.fathom │ │ ├── array-literal-not-supported.snap │ │ ├── block-comment.fathom │ │ ├── block-comment.snap │ │ ├── boolean-literal │ │ │ ├── not-supported.fathom │ │ │ ├── not-supported.snap │ │ │ ├── type-mismatch.fathom │ │ │ └── type-mismatch.snap │ │ ├── duplicate-field-labels │ │ │ ├── record-literal.fathom │ │ │ ├── record-literal.snap │ │ │ ├── record-type.fathom │ │ │ └── record-type.snap │ │ ├── implicit-args │ │ │ ├── app-plicity-mismatch.fathom │ │ │ ├── app-plicity-mismatch.snap │ │ │ ├── unexpected-argument.fathom │ │ │ └── unexpected-argument.snap │ │ ├── item-cycle.fathom │ │ ├── item-cycle.snap │ │ ├── mismatched-array-length │ │ │ ├── array16.fathom │ │ │ ├── array16.snap │ │ │ ├── array32.fathom │ │ │ ├── array32.snap │ │ │ ├── array64.fathom │ │ │ ├── array64.snap │ │ │ ├── array8.fathom │ │ │ └── array8.snap │ │ ├── mismatched-field-labels │ │ │ ├── expected-field.fathom │ │ │ ├── expected-field.snap │ │ │ ├── missing-field.fathom │ │ │ ├── missing-field.snap │ │ │ ├── tuple.fathom │ │ │ ├── tuple.snap │ │ │ ├── unexpected-field.fathom │ │ │ └── unexpected-field.snap │ │ ├── non-exhaustive-patterns │ │ │ ├── match-check.fathom │ │ │ ├── match-check.snap │ │ │ ├── match-duplicate.fathom │ │ │ ├── match-duplicate.snap │ │ │ ├── match-synth.fathom │ │ │ └── match-synth.snap │ │ ├── numeric-literal │ │ │ ├── ambiguous.fathom │ │ │ ├── ambiguous.snap │ │ │ ├── invalid.fathom │ │ │ ├── invalid.snap │ │ │ ├── mismatched-length.fathom │ │ │ ├── mismatched-length.snap │ │ │ ├── not-supported.fathom │ │ │ └── not-supported.snap │ │ ├── string-literal │ │ │ ├── ambiguous.fathom │ │ │ ├── ambiguous.snap │ │ │ ├── non-ascii.fathom │ │ │ ├── non-ascii.snap │ │ │ ├── not-supported.fathom │ │ │ ├── not-supported.snap │ │ │ ├── overflowing.fathom │ │ │ ├── overflowing.snap │ │ │ ├── underflowing.fathom │ │ │ └── underflowing.snap │ │ ├── unbound-name.fathom │ │ ├── unbound-name.snap │ │ ├── unexpected-argument │ │ │ ├── record-type.fathom │ │ │ ├── record-type.snap │ │ │ ├── unbound-head-1.fathom │ │ │ ├── unbound-head-1.snap │ │ │ ├── unbound-head-2.fathom │ │ │ └── unbound-head-2.snap │ │ ├── unexpected-parameter │ │ │ ├── fun-literal.fathom │ │ │ └── fun-literal.snap │ │ ├── unification │ │ │ ├── escaping-local-var.fathom │ │ │ ├── escaping-local-var.snap │ │ │ ├── infinite-solution.fathom │ │ │ ├── infinite-solution.snap │ │ │ ├── mismatch │ │ │ │ ├── arrow-body-type.fathom │ │ │ │ ├── arrow-body-type.snap │ │ │ │ ├── arrow-both.fathom │ │ │ │ ├── arrow-both.snap │ │ │ │ ├── arrow-param-type.fathom │ │ │ │ ├── arrow-param-type.snap │ │ │ │ ├── fun-literal-body-expr.fathom │ │ │ │ ├── fun-literal-body-expr.snap │ │ │ │ ├── fun-literal-param-ann.fathom │ │ │ │ ├── fun-literal-param-ann.snap │ │ │ │ ├── fun-type-body-type.fathom │ │ │ │ ├── fun-type-body-type.snap │ │ │ │ ├── fun-type-both.fathom │ │ │ │ ├── fun-type-both.snap │ │ │ │ ├── fun-type-param-type.fathom │ │ │ │ ├── fun-type-param-type.snap │ │ │ │ ├── match-equation-body-exprs.fathom │ │ │ │ ├── match-equation-body-exprs.snap │ │ │ │ ├── record-literal-singleton.fathom │ │ │ │ ├── record-literal-singleton.snap │ │ │ │ ├── record-type-singleton.fathom │ │ │ │ └── record-type-singleton.snap │ │ │ ├── non-linear-spine.fathom │ │ │ └── non-linear-spine.snap │ │ ├── unknown-field │ │ │ ├── record-literal.fathom │ │ │ ├── record-literal.snap │ │ │ ├── type.fathom │ │ │ ├── type.snap │ │ │ ├── unbound-head.fathom │ │ │ ├── unbound-head.snap │ │ │ ├── unit-literal.fathom │ │ │ └── unit-literal.snap │ │ └── unsolved │ │ │ ├── fun-literal-param-type.fathom │ │ │ ├── fun-literal-param-type.snap │ │ │ ├── fun-literal-placeholder-body-type.fathom │ │ │ ├── fun-literal-placeholder-body-type.snap │ │ │ ├── hole-ann.fathom │ │ │ ├── hole-ann.snap │ │ │ ├── hole.fathom │ │ │ ├── hole.snap │ │ │ ├── placeholder-ann.fathom │ │ │ ├── placeholder-ann.snap │ │ │ ├── placeholder.fathom │ │ │ └── placeholder.snap │ ├── paradoxes │ │ └── hurkens.fathom │ └── parse │ │ ├── error-recovery.fathom │ │ ├── error-recovery.snap │ │ ├── unclosed-block-comment.fathom │ │ ├── unclosed-block-comment.snap │ │ ├── unexpected-character.fathom │ │ └── unexpected-character.snap └── succeed │ ├── ann │ ├── array-literal-array.fathom │ ├── array-literal-array.snap │ ├── array-literal-array16.fathom │ ├── array-literal-array16.snap │ ├── array-literal-array32.fathom │ ├── array-literal-array32.snap │ ├── array-literal-array64.fathom │ ├── array-literal-array64.snap │ ├── array-literal-array8.fathom │ ├── array-literal-array8.snap │ ├── arrow-type-type.fathom │ ├── arrow-type-type.snap │ ├── fun-literal-identity-mono-input-ann-placeholder.fathom │ ├── fun-literal-identity-mono-input-ann-placeholder.snap │ ├── fun-literal-identity-mono-input-ann-type.fathom │ ├── fun-literal-identity-mono-input-ann-type.snap │ ├── fun-literal-identity-mono.fathom │ ├── fun-literal-identity-mono.snap │ ├── fun-literal-identity-poly-input-placeholder.fathom │ ├── fun-literal-identity-poly-input-placeholder.snap │ ├── fun-literal-identity-poly-sugar.fathom │ ├── fun-literal-identity-poly-sugar.snap │ ├── fun-literal-identity-poly.fathom │ ├── fun-literal-identity-poly.snap │ ├── fun-literal-placeholder-body-type.fathom │ ├── fun-literal-placeholder-body-type.snap │ ├── fun-type-identity-mono.fathom │ ├── fun-type-identity-mono.snap │ ├── fun-type-identity-poly-hole.fathom │ ├── fun-type-identity-poly-hole.snap │ ├── fun-type-identity-poly.fathom │ ├── fun-type-identity-poly.snap │ ├── record-literal-pair-dependent.fathom │ ├── record-literal-pair-dependent.snap │ ├── record-literal-pair.fathom │ ├── record-literal-pair.snap │ ├── record-type-pair.fathom │ ├── record-type-pair.snap │ ├── string-literal-char.fathom │ ├── string-literal-char.snap │ ├── type.fathom │ ├── type.snap │ ├── unit-literal-expr.fathom │ ├── unit-literal-expr.snap │ ├── unit-literal-format.fathom │ ├── unit-literal-format.snap │ ├── unit-literal-type.fathom │ └── unit-literal-type.snap │ ├── arrow │ ├── identity.fathom │ └── identity.snap │ ├── binops │ ├── check.fathom │ ├── check.snap │ ├── distillation.fathom │ ├── distillation.snap │ ├── synth.fathom │ └── synth.snap │ ├── distillation │ ├── fresh-names.fathom │ └── fresh-names.snap │ ├── equality.fathom │ ├── equality.snap │ ├── format-cond │ ├── simple.fathom │ └── simple.snap │ ├── format-deref │ ├── simple.fathom │ └── simple.snap │ ├── format-overlap │ ├── dependent.fathom │ ├── dependent.snap │ ├── field-refinements.fathom │ ├── field-refinements.snap │ ├── numbers.fathom │ └── numbers.snap │ ├── format-record │ ├── computed-fields.fathom │ ├── computed-fields.snap │ ├── field-refinements.fathom │ ├── field-refinements.snap │ ├── pair-dependent.fathom │ ├── pair-dependent.snap │ ├── pair.fathom │ └── pair.snap │ ├── format-repr │ ├── coercions.fathom │ ├── coercions.snap │ ├── pair-dependent.fathom │ ├── pair-dependent.snap │ ├── primitives.fathom │ ├── primitives.snap │ ├── record.fathom │ ├── record.snap │ ├── unit-literal.fathom │ └── unit-literal.snap │ ├── fun-elim │ ├── ann-identity-mono-0.fathom │ ├── ann-identity-mono-0.snap │ ├── ann-identity-mono-1.fathom │ ├── ann-identity-mono-1.snap │ ├── ann-identity-mono-2.fathom │ ├── ann-identity-mono-2.snap │ ├── ann-identity-poly-0.fathom │ ├── ann-identity-poly-0.snap │ ├── ann-identity-poly-1.fathom │ ├── ann-identity-poly-1.snap │ ├── identity-mono-0.fathom │ ├── identity-mono-0.snap │ ├── identity-mono-1.fathom │ └── identity-mono-1.snap │ ├── fun-literal │ ├── identity-mono.fathom │ ├── identity-mono.snap │ ├── identity-poly-sugar.fathom │ ├── identity-poly-sugar.snap │ ├── identity-poly.fathom │ └── identity-poly.snap │ ├── fun-type │ ├── identity-mono.fathom │ ├── identity-mono.snap │ ├── identity-poly-arrow.fathom │ ├── identity-poly-arrow.snap │ ├── identity-poly-input-ann-placeholder.fathom │ ├── identity-poly-input-ann-placeholder.snap │ ├── identity-poly-input-placeholder.fathom │ ├── identity-poly-input-placeholder.snap │ ├── identity-poly-sugar.fathom │ ├── identity-poly-sugar.snap │ ├── identity-poly.fathom │ └── identity-poly.snap │ ├── hole │ ├── hole-0.fathom │ ├── hole-0.snap │ ├── hole-1.fathom │ └── hole-1.snap │ ├── if-then-else │ ├── check.fathom │ ├── check.snap │ ├── pretty.fathom │ ├── pretty.snap │ ├── synth.fathom │ └── synth.snap │ ├── implicit-args │ ├── generalize.fathom │ ├── generalize.snap │ ├── insert-args.fathom │ ├── insert-args.snap │ ├── specialize.fathom │ └── specialize.snap │ ├── let │ ├── id-type.fathom │ ├── id-type.snap │ ├── identity-placeholders.fathom │ ├── identity-placeholders.snap │ ├── identity.fathom │ ├── identity.snap │ ├── let-def-placeholder-ann.fathom │ ├── let-def-placeholder-ann.snap │ ├── let-def-placeholder.fathom │ └── let-def-placeholder.snap │ ├── match │ ├── check-const-1.fathom │ ├── check-const-1.snap │ ├── check-const-2.fathom │ ├── check-const-2.snap │ ├── check-const-bool.fathom │ ├── check-const-bool.snap │ ├── check-const-redundant.fathom │ ├── check-const-redundant.snap │ ├── check-simple-redundant.fathom │ ├── check-simple-redundant.snap │ ├── check-simple.fathom │ ├── check-simple.snap │ ├── synth-const-1.fathom │ ├── synth-const-1.snap │ ├── synth-const-2.fathom │ ├── synth-const-2.snap │ ├── synth-simple-redundant.fathom │ ├── synth-simple-redundant.snap │ ├── synth-simple.fathom │ └── synth-simple.snap │ ├── numeric-literal │ ├── binary.fathom │ ├── binary.snap │ ├── hexadecimal.fathom │ ├── hexadecimal.snap │ ├── signed.fathom │ ├── signed.snap │ ├── style-conflict.fathom │ ├── style-conflict.norm.snap │ ├── style-conflict.snap │ ├── style-preserve-binary.fathom │ ├── style-preserve-binary.norm.snap │ ├── style-preserve-binary.snap │ ├── style-propagate-binary.fathom │ ├── style-propagate-binary.norm.snap │ ├── style-propagate-binary.snap │ ├── style-propagate-hex.fathom │ ├── style-propagate-hex.norm.snap │ ├── style-propagate-hex.snap │ ├── styled.fathom │ └── styled.snap │ ├── prelude.fathom │ ├── prelude.snap │ ├── primitive-ops.fathom │ ├── primitive-ops.snap │ ├── primitives.fathom │ ├── primitives.snap │ ├── raw-identifiers.fathom │ ├── raw-identifiers.snap │ ├── record-elim │ ├── singleton.fathom │ └── singleton.snap │ ├── record-field-shorthand.fathom │ ├── record-field-shorthand.snap │ ├── record-type │ ├── generic-pair.fathom │ ├── generic-pair.snap │ ├── generic-point.fathom │ ├── generic-point.snap │ ├── generic-singleton.fathom │ ├── generic-singleton.snap │ ├── generic-triple.fathom │ ├── generic-triple.snap │ ├── pair-dependent.fathom │ ├── pair-dependent.snap │ ├── pair.fathom │ ├── pair.snap │ ├── singleton.fathom │ └── singleton.snap │ ├── stress.fathom │ ├── stress.snap │ ├── tuple │ ├── check-format.fathom │ ├── check-format.snap │ ├── check-term.fathom │ ├── check-term.snap │ ├── check-universe.fathom │ ├── check-universe.snap │ ├── generic-pair.fathom │ ├── generic-pair.snap │ ├── generic-triple.fathom │ ├── generic-triple.snap │ ├── synth.fathom │ └── synth.snap │ ├── type.fathom │ ├── type.snap │ ├── unit-literal.fathom │ └── unit-literal.snap └── yarn.lock /.editorconfig: -------------------------------------------------------------------------------- 1 | # http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | indent_style = space 6 | charset = utf-8 7 | trim_trailing_whitespace = true 8 | insert_final_newline = true 9 | 10 | [*.md,*.yml,*.js] 11 | indent_size = 2 12 | tab_width = 2 13 | 14 | [*.rs,*.fathom] 15 | indent_size = 4 16 | tab_width = 4 17 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.bin binary 2 | *.pl linguist-language=Prolog 3 | *.snap linguist-language=TOML 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | 3 | node_modules 4 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": [ 3 | "EditorConfig.EditorConfig" 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [profile.release-debug] 2 | inherits = "release" 3 | debug = true 4 | 5 | [workspace] 6 | members = [ 7 | './fathom', 8 | ] 9 | -------------------------------------------------------------------------------- /doc/README.md: -------------------------------------------------------------------------------- 1 | # Fathom Documentation 2 | 3 | ## Sections 4 | 5 | - **[Reference](./reference.md)**: a reference-level guide to Fathom 6 | - **[Roadmap](./roadmap.md)**: future ideas for Fathom 7 | - **[Background](./background.md)**: background reading, related work, and sources of inspiration 8 | -------------------------------------------------------------------------------- /experiments/lean/.gitignore: -------------------------------------------------------------------------------- 1 | *.olean 2 | /_target 3 | /leanpkg.path 4 | -------------------------------------------------------------------------------- /experiments/lean/leanpkg.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "ddl" 3 | version = "0.1" 4 | lean_version = "3.3.0" 5 | path = "src/." 6 | 7 | [dependencies] 8 | -------------------------------------------------------------------------------- /experiments/lean/src/ddl/basic.lean: -------------------------------------------------------------------------------- 1 | namespace ddl 2 | 3 | def relation (α : Type) := 4 | α → α → Prop 5 | 6 | inductive multi {α : Type} (ρ : relation α) : relation α 7 | | refl {x : α} : multi x x 8 | | step {x y z : α} : ρ x y → multi y z → multi x z 9 | 10 | end ddl 11 | -------------------------------------------------------------------------------- /experiments/lean/src/ddl/binary/default.lean: -------------------------------------------------------------------------------- 1 | import ddl.binary.basic 2 | import ddl.binary.formation 3 | import ddl.binary.kinding 4 | import ddl.binary.monad 5 | import ddl.binary.repr 6 | import ddl.binary.subst 7 | -------------------------------------------------------------------------------- /experiments/lean/src/ddl/binder.lean: -------------------------------------------------------------------------------- 1 | import ddl.host.basic 2 | import ddl.binary.basic 3 | 4 | namespace ddl 5 | 6 | open ddl 7 | 8 | inductive binder (ℓ : Type) : Type 9 | | struct : host.type ℓ → binder 10 | | lam {} : binary.kind → binder 11 | 12 | end ddl 13 | -------------------------------------------------------------------------------- /experiments/lean/src/ddl/ctx.lean: -------------------------------------------------------------------------------- 1 | import ddl.binder 2 | 3 | namespace ddl 4 | 5 | def ctx (ℓ : Type) : Type := 6 | list (binder ℓ) 7 | 8 | namespace ctx 9 | 10 | variables {ℓ : Type} 11 | 12 | def lookup (n : ℕ) (Γ : ctx ℓ) : option (binder ℓ) := 13 | list.nth Γ n 14 | 15 | def lookup_le (n : ℕ) (Γ : ctx ℓ) : n < Γ.length → binder ℓ := 16 | assume is_le, 17 | list.nth_le Γ n is_le 18 | 19 | end ctx 20 | 21 | end ddl 22 | -------------------------------------------------------------------------------- /experiments/lean/src/ddl/default.lean: -------------------------------------------------------------------------------- 1 | import ddl.basic 2 | import ddl.binary 3 | import ddl.binder 4 | import ddl.ctx 5 | import ddl.embed 6 | import ddl.host 7 | import ddl.parsing 8 | -------------------------------------------------------------------------------- /experiments/lean/src/ddl/host/default.lean: -------------------------------------------------------------------------------- 1 | import ddl.host.basic 2 | import ddl.host.evaluation 3 | import ddl.host.typing 4 | import ddl.host.lemmas 5 | -------------------------------------------------------------------------------- /experiments/lean/src/ddl/parsing.lean: -------------------------------------------------------------------------------- 1 | import ddl.binary 2 | 3 | namespace ddl 4 | 5 | -- FIXME: constrain `kt.embed` to be `Type 0` 6 | def parse {ℓ α} [decidable_eq ℓ] : Π (kt : binary.kinded_type ℓ α), list bool → /- kt.embed -/ sorry := 7 | sorry 8 | 9 | end ddl 10 | -------------------------------------------------------------------------------- /experiments/makam-spec/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "makam-spec", 3 | "version": "0.0.0", 4 | "license": "Apache-2.0", 5 | "private": true, 6 | "author": { 7 | "name": "YesLogic Pty. Ltd.", 8 | "email": "info@yeslogic.com", 9 | "url": "https://yeslogic.com" 10 | }, 11 | "scripts": { 12 | "test": "makam test/init --run-tests", 13 | "repl": "makam --include=./src" 14 | }, 15 | "devDependencies": { 16 | "makam": "^0.7.36" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /experiments/makam-spec/src/lang/core/init.makam: -------------------------------------------------------------------------------- 1 | % Core language 2 | % 3 | % The core language is a dependent type theory defined in the style 4 | % of a pure type system (PTS), with some builtin data types, like integers, 5 | % and arrays, and a universe of binary format descriptions inspired by 6 | % [the Data Description Calculus][ddc]. 7 | % 8 | % [ddc]: http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.156.1375 9 | 10 | %extend core. 11 | 12 | %use "base". % Base syntax 13 | %use "semantics". % Operational semantics 14 | %use "typing". % Typing rules 15 | %use "binary". % Binary interpretation of format descriptions 16 | 17 | %end. 18 | -------------------------------------------------------------------------------- /experiments/makam-spec/src/lang/init.makam: -------------------------------------------------------------------------------- 1 | % Intermediate languages for the Fathom data description language. 2 | 3 | %extend lang. 4 | 5 | %use "surface". 6 | %use "core/init". 7 | %use "stratified". 8 | %use "unkinded". 9 | %use "uncurried". 10 | %use "rust". 11 | 12 | %end. 13 | -------------------------------------------------------------------------------- /experiments/makam-spec/src/lang/uncurried.makam: -------------------------------------------------------------------------------- 1 | % Uncurried language 2 | % 3 | % In this language functions are _uncurried_. 4 | 5 | %extend uncurried. 6 | 7 | % TODO 8 | 9 | %end. 10 | -------------------------------------------------------------------------------- /experiments/makam-spec/src/lang/unkinded.makam: -------------------------------------------------------------------------------- 1 | % Kind-erased language 2 | % 3 | % We take this route if our target language does not have a kind system, for 4 | % example a language like Rust or OCaml. 5 | 6 | %extend unkinded. 7 | 8 | % TODO 9 | 10 | %end. 11 | -------------------------------------------------------------------------------- /experiments/makam-spec/src/pass/core_to_surface.makam: -------------------------------------------------------------------------------- 1 | % Delaboration back into the surface language 2 | 3 | %extend core_to_surface. 4 | 5 | % TODO 6 | 7 | %end. 8 | -------------------------------------------------------------------------------- /experiments/makam-spec/src/pass/stratified_to_unkinded.makam: -------------------------------------------------------------------------------- 1 | % Erasure of kinds 2 | 3 | %extend stratified_to_unkinded. 4 | 5 | % TODO 6 | 7 | %end. 8 | -------------------------------------------------------------------------------- /experiments/makam-spec/src/pass/uncurried_to_rust.makam: -------------------------------------------------------------------------------- 1 | %extend uncurried_to_rust. 2 | 3 | % TODO 4 | 5 | %end. 6 | -------------------------------------------------------------------------------- /experiments/makam-spec/src/pass/unkinded_to_uncurried.makam: -------------------------------------------------------------------------------- 1 | %extend unkinded_to_uncurried. 2 | 3 | % TODO 4 | 5 | %end. 6 | -------------------------------------------------------------------------------- /experiments/makam-spec/src/stdlib.makam: -------------------------------------------------------------------------------- 1 | % Extensions to Makam's standard library 2 | 3 | 4 | %extend map. 5 | 6 | keys : map Key Elem -> set Key -> prop. 7 | keys [] []. 8 | keys (( Key, _ ) :: Map) (Key :: Keys) :- 9 | keys Map Keys. 10 | 11 | %end. 12 | 13 | 14 | %extend set. 15 | 16 | map : (Key -> prop) -> set Key -> prop. 17 | map Prop []. 18 | map Prop (Elem :: Set) :- 19 | Prop Elem, 20 | set.remove_if_member Set Elem Set', 21 | map Prop Set'. 22 | 23 | %end. 24 | -------------------------------------------------------------------------------- /experiments/makam-spec/test/init.makam: -------------------------------------------------------------------------------- 1 | %use "../src/init". 2 | 3 | %extend fathom. 4 | 5 | %use "lang/init". 6 | %use "pass/init". 7 | 8 | %end. 9 | -------------------------------------------------------------------------------- /experiments/makam-spec/test/lang/core/init.makam: -------------------------------------------------------------------------------- 1 | %extend core. 2 | 3 | %use "semantics". 4 | %use "typing". 5 | 6 | %end. 7 | -------------------------------------------------------------------------------- /experiments/makam-spec/test/lang/init.makam: -------------------------------------------------------------------------------- 1 | %extend lang. 2 | 3 | %use "core/init". 4 | 5 | %end. 6 | -------------------------------------------------------------------------------- /experiments/makam-spec/test/pass/init.makam: -------------------------------------------------------------------------------- 1 | %extend pass. 2 | 3 | %use "surface_to_core". 4 | %use "core_to_stratified". 5 | 6 | %end. 7 | -------------------------------------------------------------------------------- /experiments/mercury-prototype/.gitignore: -------------------------------------------------------------------------------- 1 | Mercury 2 | *.mh 3 | *.err 4 | -------------------------------------------------------------------------------- /experiments/mercury-prototype/ddl/elf.ddl: -------------------------------------------------------------------------------- 1 | 2 | // FIXME endianness differs 3 | 4 | // @root 5 | ELF: struct { 6 | magic: byte[4], // FIXME = [0x7F, 'E', 'L', 'F'], 7 | class: byte = 1 | 2, // 32-bit or 64-bit 8 | data: byte = 1 | 2, // little or big endian 9 | version1: byte, // FIXME = 1 ? 10 | os_abi: byte, // FIXME 11 | abi_version: byte, // FIXME unused on Linux 12 | pad: byte[7], 13 | type: uint16 = 1 | 2 | 3 | 4, // relocatable, executable, shared, core 14 | machine: uint16, // target instruction set architecture 15 | version2: byte // FIXME version again??? 16 | } 17 | -------------------------------------------------------------------------------- /experiments/prolog-prototype/src/load.pl: -------------------------------------------------------------------------------- 1 | :- consult(util). 2 | :- consult('dl-full'). 3 | :- consult(harness). 4 | :- consult(examples). 5 | -------------------------------------------------------------------------------- /experiments/prolog-prototype/test_data/ascii-1.txt: -------------------------------------------------------------------------------- 1 | ABCDEFGHIJ 2 | 0123456789 3 | !@#$%^&*() 4 | -------------------------------------------------------------------------------- /experiments/prolog-prototype/test_data/sudoku1-1.bin: -------------------------------------------------------------------------------- 1 |    -------------------------------------------------------------------------------- /experiments/prolog-prototype/test_data/sudoku2-1.bin: -------------------------------------------------------------------------------- 1 |    -------------------------------------------------------------------------------- /experiments/prolog-prototype/test_data/sudoku3-1.bin: -------------------------------------------------------------------------------- 1 |    -------------------------------------------------------------------------------- /experiments/prolog-prototype/test_data/sudoku4-1.bin: -------------------------------------------------------------------------------- 1 |    -------------------------------------------------------------------------------- /experiments/prolog-prototype/test_data/sudoku5-1.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yeslogic/fathom/3960a9466150d392c2cb103c5cb5fcffa0200814/experiments/prolog-prototype/test_data/sudoku5-1.bin -------------------------------------------------------------------------------- /experiments/prolog-prototype/test_data/tree-1.bin: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /experiments/prolog-prototype/test_data/xy_z-1.bin: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /experiments/prolog-prototype/test_data/xy_z-2.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yeslogic/fathom/3960a9466150d392c2cb103c5cb5fcffa0200814/experiments/prolog-prototype/test_data/xy_z-2.bin -------------------------------------------------------------------------------- /experiments/prolog-prototype/test_data/xy_z-3.bin: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /experiments/prolog-prototype/test_data/xyz-1.bin: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /experiments/prolog-prototype/test_data/xyz-2.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yeslogic/fathom/3960a9466150d392c2cb103c5cb5fcffa0200814/experiments/prolog-prototype/test_data/xyz-2.bin -------------------------------------------------------------------------------- /experiments/prolog-prototype/test_data/xyz-3.bin: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /experiments/rust-prototype-v1/.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | **/*.rs.bk 3 | Cargo.lock 4 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v1/book/.gitignore: -------------------------------------------------------------------------------- 1 | /book 2 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v1/book/README.md: -------------------------------------------------------------------------------- 1 | # DDL Book 2 | 3 | To build, install mdBook via cargo: 4 | 5 | ```sh 6 | cargo install mdbook 7 | ``` 8 | 9 | You can then serve the documentation locally by calling this command from the `book` directory: 10 | 11 | ```sh 12 | mdbook serve 13 | ``` 14 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v1/book/book.toml: -------------------------------------------------------------------------------- 1 | [output.html] 2 | mathjax-support = true 3 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v1/book/src/SUMMARY.md: -------------------------------------------------------------------------------- 1 | # Summary 2 | 3 | - [Chapter 1](./chapter_1.md) 4 | - [Specification](./specification.md) 5 | - [Appendix](./appendix.md) 6 | - [Alignment](./appendix/alignment.md) 7 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v1/book/src/appendix.md: -------------------------------------------------------------------------------- 1 | # Appendix 2 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v1/book/src/chapter_1.md: -------------------------------------------------------------------------------- 1 | # Chapter 1 2 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v1/build.rs: -------------------------------------------------------------------------------- 1 | extern crate lalrpop; 2 | 3 | fn main() { 4 | lalrpop::Configuration::new() 5 | .always_use_colors() 6 | .use_cargo_dir_conventions() 7 | .process() 8 | .unwrap(); 9 | } 10 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v1/ddl-util/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "ddl-util" 3 | description = "Helper functions for parsers generated by the ddl crate" 4 | version = "0.1.0" 5 | authors = ["Brendan Zabarauskas "] 6 | 7 | [dependencies] 8 | byteorder = "1.1.0" 9 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v1/examples/features/README.md: -------------------------------------------------------------------------------- 1 | # Examples of features in use 2 | 3 | These examples show some of the features of the DDL 4 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v1/examples/features/type-params/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "ddl-features-type-params" 3 | version = "0.0.0" 4 | license = "Apache-2.0" 5 | publish = false 6 | 7 | [dependencies] 8 | ddl-util = { path = "../../../ddl-util" } 9 | 10 | [build-dependencies] 11 | codespan = { git = "https://github.com/brendanzab/codespan", rev = "e25e243", version = "0.1.0" } 12 | codespan-reporting = { git = "https://github.com/brendanzab/codespan", rev = "e25e243", version = "0.1.0" } 13 | ddl = { path = "../../.." } 14 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v1/examples/features/type-params/src/lib.rs: -------------------------------------------------------------------------------- 1 | pub mod pair { 2 | include!(concat!(env!("OUT_DIR"), "/pair.rs")); 3 | } 4 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v1/examples/features/type-params/src/pair.ddl: -------------------------------------------------------------------------------- 1 | Pair(T, U) = struct { 2 | first: T, 3 | second: U, 4 | }; 5 | 6 | MyPair = Pair(i32be, u64le); 7 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v1/examples/formats/README.md: -------------------------------------------------------------------------------- 1 | # Examples of common file formats 2 | 3 | These examples show how the DDL can be used to describe common binary file formats 4 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v1/examples/formats/bitmap/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "ddl-bitmap" 3 | version = "0.0.0" 4 | license = "Apache-2.0" 5 | publish = false 6 | 7 | [dependencies] 8 | ddl-util = { path = "../../../ddl-util" } 9 | 10 | [build-dependencies] 11 | codespan = { git = "https://github.com/brendanzab/codespan", rev = "e25e243", version = "0.1.0" } 12 | codespan-reporting = { git = "https://github.com/brendanzab/codespan", rev = "e25e243", version = "0.1.0" } 13 | ddl = { path = "../../.." } 14 | 15 | [dev-dependencies] 16 | difference = "1.0.0" 17 | pretty_assertions = "0.4.0" 18 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v1/examples/formats/bitmap/src/bitmap.ddl: -------------------------------------------------------------------------------- 1 | Pixel = struct { 2 | r : u8, 3 | g : u8, 4 | b : u8, 5 | a : u8, 6 | }; 7 | 8 | Bitmap = struct { 9 | extents : struct { 10 | width : u32be, 11 | height : u32be, 12 | }, 13 | data : [Pixel; extents.width * extents.height], 14 | }; 15 | 16 | Bmp = Bitmap; 17 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v1/examples/formats/bitmap/src/lib.rs: -------------------------------------------------------------------------------- 1 | pub mod parser { 2 | include!(concat!(env!("OUT_DIR"), "/bitmap.rs")); 3 | } 4 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v1/examples/formats/bson/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "ddl-bson" 3 | version = "0.0.0" 4 | license = "Apache-2.0" 5 | publish = false 6 | 7 | [dependencies] 8 | ddl-util = { path = "../../../ddl-util" } 9 | 10 | [build-dependencies] 11 | codespan = { git = "https://github.com/brendanzab/codespan", rev = "e25e243", version = "0.1.0" } 12 | codespan-reporting = { git = "https://github.com/brendanzab/codespan", rev = "e25e243", version = "0.1.0" } 13 | ddl = { path = "../../.." } 14 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v1/examples/formats/bson/src/lib.rs: -------------------------------------------------------------------------------- 1 | include!(concat!(env!("OUT_DIR"), "/bson.rs")); 2 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v1/examples/formats/edid/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "ddl-edid" 3 | version = "0.0.0" 4 | license = "Apache-2.0" 5 | publish = false 6 | 7 | [dependencies] 8 | ddl-util = { path = "../../../ddl-util" } 9 | 10 | [build-dependencies] 11 | codespan = { git = "https://github.com/brendanzab/codespan", rev = "e25e243", version = "0.1.0" } 12 | codespan-reporting = { git = "https://github.com/brendanzab/codespan", rev = "e25e243", version = "0.1.0" } 13 | ddl = { path = "../../.." } 14 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v1/examples/formats/edid/src/lib.rs: -------------------------------------------------------------------------------- 1 | include!(concat!(env!("OUT_DIR"), "/edid.rs")); 2 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v1/examples/formats/edid/tests/fixtures/README.md: -------------------------------------------------------------------------------- 1 | # EDID Fixtures 2 | 3 | These were obtained on macOS using: 4 | 5 | ```bash 6 | ioreg -lr -w 0 -k IODisplayEDID | grep IODisplayEDID | sed 's/.*<\(.*\)>/\1/' 7 | ``` 8 | 9 | The hex-dumps can then be output to fixtures using: 10 | 11 | ```bash 12 | echo 'HEXDUMP' | xxd -r -p > examples/formats/edid/tests/fixtures/FIXTURE_NAME.bin 13 | ```` 14 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v1/examples/formats/edid/tests/fixtures/mbp_2013_built_in_retina.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yeslogic/fathom/3960a9466150d392c2cb103c5cb5fcffa0200814/experiments/rust-prototype-v1/examples/formats/edid/tests/fixtures/mbp_2013_built_in_retina.bin -------------------------------------------------------------------------------- /experiments/rust-prototype-v1/examples/formats/edid/tests/fixtures/mbp_2017_built_in_retina.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yeslogic/fathom/3960a9466150d392c2cb103c5cb5fcffa0200814/experiments/rust-prototype-v1/examples/formats/edid/tests/fixtures/mbp_2017_built_in_retina.bin -------------------------------------------------------------------------------- /experiments/rust-prototype-v1/examples/formats/edid/tests/fixtures/yamakasi_0270led.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yeslogic/fathom/3960a9466150d392c2cb103c5cb5fcffa0200814/experiments/rust-prototype-v1/examples/formats/edid/tests/fixtures/yamakasi_0270led.bin -------------------------------------------------------------------------------- /experiments/rust-prototype-v1/examples/formats/object_id/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "ddl-object_id" 3 | version = "0.0.0" 4 | license = "Apache-2.0" 5 | publish = false 6 | 7 | [dependencies] 8 | ddl-util = { path = "../../../ddl-util" } 9 | hex = "0.3.1" 10 | 11 | [build-dependencies] 12 | codespan = { git = "https://github.com/brendanzab/codespan", rev = "e25e243", version = "0.1.0" } 13 | codespan-reporting = { git = "https://github.com/brendanzab/codespan", rev = "e25e243", version = "0.1.0" } 14 | ddl = { path = "../../.." } 15 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v1/examples/formats/object_id/src/object_id.ddl: -------------------------------------------------------------------------------- 1 | /// https://docs.mongodb.com/manual/reference/method/ObjectId/ 2 | ObjectId = struct { 3 | epoch_time: i32be, 4 | machine_id: u24be, 5 | process_id: u16be, 6 | counter: u24be, 7 | }; 8 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v1/examples/formats/stl/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "ddl-stl" 3 | version = "0.0.0" 4 | license = "Apache-2.0" 5 | publish = false 6 | 7 | [dependencies] 8 | ddl-util = { path = "../../../ddl-util" } 9 | 10 | [build-dependencies] 11 | codespan = { git = "https://github.com/brendanzab/codespan", rev = "e25e243", version = "0.1.0" } 12 | codespan-reporting = { git = "https://github.com/brendanzab/codespan", rev = "e25e243", version = "0.1.0" } 13 | ddl = { path = "../../.." } 14 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v1/examples/formats/stl/src/lib.rs: -------------------------------------------------------------------------------- 1 | include!(concat!(env!("OUT_DIR"), "/stl_parser.rs")); 2 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v1/examples/formats/stl/tests/fixtures/LICENCE: -------------------------------------------------------------------------------- 1 | beethoven.stl: licensed under the Public Domain License (via https://github.com/aranzgeo/steno3d-stl) 2 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v1/examples/formats/stl/tests/fixtures/beethoven.stl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yeslogic/fathom/3960a9466150d392c2cb103c5cb5fcffa0200814/experiments/rust-prototype-v1/examples/formats/stl/tests/fixtures/beethoven.stl -------------------------------------------------------------------------------- /experiments/rust-prototype-v1/examples/formats/stl/tests/fixtures/cube.stl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yeslogic/fathom/3960a9466150d392c2cb103c5cb5fcffa0200814/experiments/rust-prototype-v1/examples/formats/stl/tests/fixtures/cube.stl -------------------------------------------------------------------------------- /experiments/rust-prototype-v1/src/syntax/mod.rs: -------------------------------------------------------------------------------- 1 | //! The surface level representation of our data description language 2 | 3 | pub mod concrete; 4 | pub mod core; 5 | pub mod parse; 6 | pub mod translation; 7 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v1/src/syntax/parse/grammar.rs: -------------------------------------------------------------------------------- 1 | #![cfg_attr(feature = "cargo-clippy", allow(clippy))] 2 | 3 | include!(concat!(env!("OUT_DIR"), "/syntax/parse/grammar.rs")); 4 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v1/src/syntax/parse/snapshots/tests.parse_simple_definition.snap: -------------------------------------------------------------------------------- 1 | Module { 2 | definitions: [ 3 | Definition { 4 | doc: "", 5 | name: Ident("Offset32"), 6 | body_ty: Var( 7 | Span { 8 | start: ByteIndex(21), 9 | end: ByteIndex(24) 10 | }, 11 | Free( 12 | User( 13 | Ident("u32") 14 | ) 15 | ) 16 | ) 17 | } 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v1/src/syntax/parse/snapshots/tests.parse_ty_empty_struct.snap: -------------------------------------------------------------------------------- 1 | Struct( 2 | Span { 3 | start: ByteIndex(1), 4 | end: ByteIndex(10) 5 | }, 6 | [] 7 | ) 8 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v1/src/syntax/parse/snapshots/tests.parse_ty_var.snap: -------------------------------------------------------------------------------- 1 | Var( 2 | Span { 3 | start: ByteIndex(10), 4 | end: ByteIndex(15) 5 | }, 6 | Free( 7 | User( 8 | Ident("Point") 9 | ) 10 | ) 11 | ) 12 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v1/src/syntax/snapshots/core.ty_abs_id.snap: -------------------------------------------------------------------------------- 1 | Lam( 2 | Span { 3 | start: ByteIndex(0), 4 | end: ByteIndex(0) 5 | }, 6 | [ 7 | Named { 8 | name: User( 9 | Ident("x") 10 | ), 11 | inner: Binary 12 | } 13 | ], 14 | Var( 15 | Span { 16 | start: ByteIndex(0), 17 | end: ByteIndex(0) 18 | }, 19 | Bound( 20 | Named { 21 | name: User( 22 | Ident("x") 23 | ), 24 | inner: BoundVar(0, 0) 25 | } 26 | ) 27 | ) 28 | ) 29 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v1/src/syntax/translation/mod.rs: -------------------------------------------------------------------------------- 1 | mod concrete_to_core; 2 | 3 | pub use self::concrete_to_core::ToCore; 4 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v2/.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | Cargo.lock 3 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v2/.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "book/highlight.js"] 2 | path = book/highlight.js 3 | url = https://github.com/pikelet-lang/highlight.js.git 4 | branch = add-pikelet 5 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v2/assets/yeslogic-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yeslogic/fathom/3960a9466150d392c2cb103c5cb5fcffa0200814/experiments/rust-prototype-v2/assets/yeslogic-logo.png -------------------------------------------------------------------------------- /experiments/rust-prototype-v2/book/.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | theme/highlight.js 3 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v2/book/book.toml: -------------------------------------------------------------------------------- 1 | [book] 2 | title = "DDL Book" 3 | authors = ["Brendan Zabarauskas"] 4 | description = "Documentation for the DDL" 5 | multilingual = false 6 | src = "src" 7 | 8 | [build] 9 | build-dir = "build" 10 | 11 | [output.html] 12 | mathjax-support = true 13 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v2/book/src/SUMMARY.md: -------------------------------------------------------------------------------- 1 | # Summary 2 | 3 | [DDL](index.md) 4 | 5 | - [Installation](./installation/index.md) 6 | - [Language](./language/index.md) 7 | - [Appendix](./appendix/index.md) 8 | - [Theory](./appendix/theory.md) 9 | - [Influences](./appendix/influences.md) 10 | - [References](./appendix/references.md) 11 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v2/book/src/appendix/index.md: -------------------------------------------------------------------------------- 1 | # Appendix 2 | 3 | Here you will find additional reference information for understanding the 4 | theoretical foundations behind the DDL. 5 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v2/book/src/appendix/influences.md: -------------------------------------------------------------------------------- 1 | # Influences 2 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v2/book/src/index.md: -------------------------------------------------------------------------------- 1 | # DDL (placeholder name) 2 | 3 | A declarative data definition language for formally specifying binary 4 | data formats. 5 | 6 | ## Example 7 | 8 | ```plain 9 | Bitmap = struct { 10 | width: u16le, 11 | height: u16le, 12 | data: [u8; width * height], 13 | }; 14 | ``` 15 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v2/book/src/language/index.md: -------------------------------------------------------------------------------- 1 | # Language 2 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v2/build.rs: -------------------------------------------------------------------------------- 1 | extern crate lalrpop; 2 | 3 | fn main() { 4 | lalrpop::Configuration::new() 5 | .always_use_colors() 6 | .use_cargo_dir_conventions() 7 | .process() 8 | .unwrap(); 9 | } 10 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v2/ci/build-book: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -euo pipefail 3 | 4 | main() { 5 | mdbook build book 6 | } 7 | 8 | main 9 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v2/ci/install-cargo-updates: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -euo pipefail 3 | 4 | main() { 5 | (test -x "$HOME/.cargo/bin/cargo-install-update" || cargo install cargo-update) 6 | (test -x "$HOME/.cargo/bin/mdbook" || cargo install --vers "^0.1.7" mdbook) # https://github.com/rust-lang-nursery/mdBook#installation 7 | cargo install-update --all 8 | } 9 | 10 | main 11 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v2/rustfmt.toml: -------------------------------------------------------------------------------- 1 | unstable_features = true 2 | match_block_trailing_comma = true 3 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v2/src/main.rs: -------------------------------------------------------------------------------- 1 | use ddl::cli::Opts; 2 | use failure::Error; 3 | use structopt::StructOpt; 4 | 5 | fn main() -> Result<(), Error> { 6 | ddl::cli::run(Opts::from_args()) 7 | } 8 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v2/src/syntax/translation/mod.rs: -------------------------------------------------------------------------------- 1 | //! Translations between representations in the compiler 2 | 3 | mod desugar; 4 | mod resugar; 5 | 6 | pub use self::desugar::{Desugar, DesugarEnv, DesugarError, DesugarGlobals}; 7 | pub use self::resugar::{Resugar, ResugarEnv}; 8 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v2/tests/fixtures/bitmap_flat.ddl: -------------------------------------------------------------------------------- 1 | module bitmap; 2 | 3 | // FIXME: A tad hacky - add operators and proper bounds handling? 4 | nat_mul : int {0 ..} -> int {0 ..} -> int {0 ..}; 5 | nat_mul = extern "int-mul"; 6 | 7 | struct Bitmap { 8 | header : Header, 9 | data : Array (nat_mul header.height header.width) (Color F32Be), 10 | }; 11 | 12 | struct Header { 13 | width : U32Be, 14 | height : U32Be, 15 | }; 16 | 17 | struct Color (A : Type) { 18 | r : F32Be, 19 | g : F32Be, 20 | b : F32Be, 21 | }; 22 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v2/tests/fixtures/bitmap_nested.ddl: -------------------------------------------------------------------------------- 1 | module bitmap; 2 | 3 | struct Bitmap { 4 | header : Header, 5 | data : Array header.height (Array header.width (Color F32Be)), 6 | }; 7 | 8 | struct Header { 9 | width : U32Be, 10 | height : U32Be, 11 | }; 12 | 13 | struct Color (A : Type) { 14 | r : F32Be, 15 | g : F32Be, 16 | b : F32Be, 17 | }; 18 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v2/tests/goldenfiles/ann: -------------------------------------------------------------------------------- 1 | RcTerm { 2 | inner: Ann( 3 | RcTerm { 4 | inner: Universe( 5 | Span { 6 | start: ByteIndex(1), 7 | end: ByteIndex(5) 8 | }, 9 | Level( 10 | 0 11 | ) 12 | ) 13 | }, 14 | RcTerm { 15 | inner: Universe( 16 | Span { 17 | start: ByteIndex(8), 18 | end: ByteIndex(12) 19 | }, 20 | Level( 21 | 0 22 | ) 23 | ) 24 | } 25 | ) 26 | } -------------------------------------------------------------------------------- /experiments/rust-prototype-v2/tests/goldenfiles/ty: -------------------------------------------------------------------------------- 1 | RcTerm { 2 | inner: Universe( 3 | Span { 4 | start: ByteIndex(1), 5 | end: ByteIndex(5) 6 | }, 7 | Level( 8 | 0 9 | ) 10 | ) 11 | } -------------------------------------------------------------------------------- /experiments/rust-prototype-v2/tests/goldenfiles/ty_level: -------------------------------------------------------------------------------- 1 | RcTerm { 2 | inner: Universe( 3 | Span { 4 | start: ByteIndex(1), 5 | end: ByteIndex(7) 6 | }, 7 | Level( 8 | 2 9 | ) 10 | ) 11 | } -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/Cargo.toml: -------------------------------------------------------------------------------- 1 | [workspace] 2 | members = [ 3 | './fathom', 4 | './fathom-cli', 5 | './fathom-runtime', 6 | './fathom-test', 7 | './fathom-test-util', 8 | ] 9 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/book/.gitignore: -------------------------------------------------------------------------------- 1 | # mdBook 2 | build 3 | 4 | # Parcel 5 | .cache 6 | dist 7 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/book/book.toml: -------------------------------------------------------------------------------- 1 | [book] 2 | title = "Fathom Book" 3 | authors = ["YesLogic Pty. Ltd. "] 4 | description = "Documentation for the Fathom data description language" 5 | language = "en" 6 | multilingual = false 7 | src = "src" 8 | 9 | [build] 10 | build-dir = "build" 11 | 12 | [output.html] 13 | additional-js = [ 14 | "dist/index.js", 15 | ] 16 | 17 | [output.linkcheck] 18 | follow-web-links = false # Avoid intermittent failures on CI from transient network errors 19 | exclude = [ 20 | '\./code-of-conduct\.md', # Bypass `traverse-parent-directories` for this symlink 21 | ] 22 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/book/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "book", 3 | "version": "0.0.0", 4 | "license": "Apache-2.0", 5 | "private": true, 6 | "author": { 7 | "name": "YesLogic Pty. Ltd.", 8 | "email": "info@yeslogic.com", 9 | "url": "https://yeslogic.com" 10 | }, 11 | "scripts": { 12 | "dev": "parcel index.js --no-source-maps", 13 | "build": "parcel build index.js --no-source-maps" 14 | }, 15 | "devDependencies": { 16 | "parcel-bundler": "^1.12.4" 17 | }, 18 | "dependencies": { 19 | "highlight.js": "^10.4.1" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/book/src/development/code-of-conduct.md: -------------------------------------------------------------------------------- 1 | ../../../CODE_OF_CONDUCT.md -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/book/src/guide.md: -------------------------------------------------------------------------------- 1 | # Language Guide 2 | 3 | Welcome to the Fathom Language Guide! 4 | This part of the documentation will guide you through the installation of Fathom, 5 | and show you how to start specifying your own binary formats. 6 | 7 | ## Summary 8 | 9 | - [Installation]() 10 | - [Your First Binary Format](./guide/first-format.md) 11 | - [Formats and Representations]() 12 | - [Common Patterns]() 13 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/book/src/reference/enumerations.md: -------------------------------------------------------------------------------- 1 | # Enumerations 2 | 3 | ## Formation 4 | 5 | ```fathom 6 | enum Bool : Type { 7 | true, 8 | false, 9 | }; 10 | ``` 11 | 12 | ## Introduction 13 | 14 | ```fathom 15 | true : Bool 16 | ``` 17 | 18 | ## Elimination 19 | 20 | > **TODO**: add documentation 21 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/book/src/reference/lexical-syntax.md: -------------------------------------------------------------------------------- 1 | # Lexical Syntax 2 | 3 | ## Comments 4 | 5 | Line comments are preceded by `//`: 6 | 7 | ```fathom 8 | // A line comment 9 | ``` 10 | 11 | ## Doc comments 12 | 13 | Module-level doc comments are preceded by `//!`: 14 | 15 | ```fathom 16 | //! A module-level doc comment 17 | ``` 18 | 19 | Definition-level doc comments are preceded by `///`: 20 | 21 | ```fathom 22 | /// A doc comment for a definitions 23 | ``` 24 | 25 | ## Keywords 26 | 27 | > **TODO**: add documentation 28 | 29 | ## Identifiers 30 | 31 | > **TODO**: add documentation 32 | 33 | ## Operators 34 | 35 | > **TODO**: add documentation 36 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/book/src/reference/sorts.md: -------------------------------------------------------------------------------- 1 | # Sorts 2 | 3 | Fathom has two sorts, `Type` and `Kind`, with a single axiom: 4 | 5 | ```fathom 6 | Type : Kind 7 | ``` 8 | 9 | `Kind` has no type, so it may only ever appear in type annotations. 10 | For example it cannot be used in top-level definitions: 11 | 12 | ```fathom 13 | const MyKind = Kind; // error! 14 | ``` 15 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/book/src/specification/textual-representation.md: -------------------------------------------------------------------------------- 1 | # Textual Representation 2 | 3 | This section describes the textual representation of the data description language. 4 | This how most users will interact with data descriptions. 5 | 6 | ## Summary 7 | 8 | - [Lexical Syntax](./textual-representation/lexical-syntax.md) 9 | - [Concrete Syntax](./textual-representation/concrete-syntax.md) 10 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/book/theme/highlight.js: -------------------------------------------------------------------------------- 1 | // Override mdBook's highlight.js in favour of the one from npm, imported in ../index.js. 2 | // To avoid exceptions coming from ../build/html/book.js we declare a global `hljs` object with some no-op methods. 3 | // This a workaround for https://github.com/rust-lang/mdBook/issues/657 4 | 5 | // prettier-ignore 6 | var hljs = { 7 | configure: function () {}, 8 | highlightBlock: function () {} 9 | }; 10 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/examples/data/stl/cube.stl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yeslogic/fathom/3960a9466150d392c2cb103c5cb5fcffa0200814/experiments/rust-prototype-v3/examples/data/stl/cube.stl -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/examples/icns.fathom: -------------------------------------------------------------------------------- 1 | //! # Apple Icon Image format 2 | //! 3 | //! ## References 4 | //! 5 | //! - [Wikipedia](https://en.wikipedia.org/wiki/Apple_Icon_Image_format) 6 | 7 | struct Header : Format { 8 | magic : U32Be, // TODO: if `magic == ascii "icns"` 9 | file_length : U32Be, 10 | } 11 | 12 | struct IconData : Format { 13 | icon_type : U32Be, // TODO: bit patterns 14 | icon_data_length : U32Be, 15 | // TODO: decode data based on `icon_type` 16 | // TODO: while `current_pos < data_start + icon_data_length` 17 | data : FormatArray 0 U8, 18 | } 19 | 20 | struct Main : Format { 21 | header : Header, 22 | icons : FormatArray 0 IconData, // TODO: while not EOF 23 | } 24 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/examples/stl.fathom: -------------------------------------------------------------------------------- 1 | //! Binary STL File 2 | //! 3 | //! # References 4 | //! 5 | //! - [Wikipedia](https://en.wikipedia.org/wiki/STL_(file_format)#Binary_STL) 6 | 7 | // TODO: STL variants: 8 | // - VisCAM 9 | // - SolidView 10 | // - Materialise Magics 11 | 12 | struct Vec3d : Format { 13 | x : F32Le, 14 | y : F32Le, 15 | z : F32Le, 16 | } 17 | 18 | struct Triangle : Format { 19 | normal : Vec3d, 20 | vertices : FormatArray 3 Vec3d, 21 | attribute_byte_count : U16Le, 22 | } 23 | 24 | struct Main : Format { 25 | header : FormatArray 80 U8, 26 | triangle_count : U32Le, 27 | triangles : FormatArray triangle_count Triangle, 28 | } 29 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/fathom-cli/src/commands.rs: -------------------------------------------------------------------------------- 1 | pub mod check; 2 | pub mod compile; 3 | pub mod data; 4 | pub mod doc; 5 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/fathom-cli/src/main.rs: -------------------------------------------------------------------------------- 1 | use structopt::StructOpt; 2 | 3 | fn main() -> anyhow::Result<()> { 4 | fathom_cli::run(fathom_cli::Options::from_args()) 5 | } 6 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/fathom-cli/tests/cli/compile.rs: -------------------------------------------------------------------------------- 1 | use assert_cmd::prelude::*; 2 | use predicates::prelude::*; 3 | use std::process::Command; 4 | 5 | #[test] 6 | fn target_rust_is_not_implemented() -> anyhow::Result<()> { 7 | let mut cmd = Command::cargo_bin("fathom")?; 8 | 9 | cmd.args(&[ 10 | "compile", 11 | "--target=rust", 12 | "--format-file=../examples/stl.fathom", 13 | ]); 14 | 15 | cmd.assert() 16 | .failure() 17 | .stdout(predicate::str::is_empty()) 18 | .stderr(predicate::str::contains("not yet implemented")); 19 | 20 | Ok(()) 21 | } 22 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/fathom-cli/tests/cli/lib.rs: -------------------------------------------------------------------------------- 1 | //! Integration tests for the command line interface. 2 | 3 | mod check; 4 | mod compile; 5 | mod data; 6 | mod doc; 7 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/fathom-cli/tests/source_tests.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | let args = libtest_mimic::Arguments::from_args(); 3 | 4 | std::env::set_current_dir("..").unwrap(); 5 | 6 | let tests = std::iter::empty() 7 | .chain(fathom_test::find_fathom_files("examples").map(fathom_test::simple_test)) 8 | .chain(fathom_test::find_fathom_files("tests").map(fathom_test::full_test)) 9 | .collect(); 10 | let run_test = fathom_test::run_test(env!("CARGO_BIN_EXE_fathom")); 11 | 12 | libtest_mimic::run_tests(&args, tests, run_test).exit(); 13 | } 14 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/fathom-runtime/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "fathom-runtime" 3 | version = "0.1.0" 4 | authors = ["YesLogic Pty. Ltd. "] 5 | edition = "2018" 6 | publish = false # TODO: Remove this when we are ready to publish to crates.io 7 | 8 | description = "Runtime support for Fathom" 9 | license = "Apache-2.0" 10 | 11 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 12 | 13 | [dev-dependencies] 14 | proptest = "1" 15 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/fathom-test-util/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "fathom-test-util" 3 | version = "0.1.0" 4 | authors = ["YesLogic Pty. Ltd. "] 5 | edition = "2018" 6 | publish = false # NOTE: This crate is only needed for testing 7 | 8 | description = "Integration tests for the binary data description language" 9 | license = "Apache-2.0" 10 | 11 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 12 | 13 | [dependencies] 14 | codespan-reporting = "0.11" 15 | fathom = { path = "../fathom" } 16 | lazy_static = "1.4" 17 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/fathom/build.rs: -------------------------------------------------------------------------------- 1 | fn main() -> Result<(), Box> { 2 | lalrpop::Configuration::new() 3 | .always_use_colors() 4 | .process_current_dir() 5 | } 6 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/fathom/src/lang/core/binary.rs: -------------------------------------------------------------------------------- 1 | //! Binary interpreter for Fathom. 2 | //! 3 | //! This is only a naive implementation, and intended for getting a better idea 4 | //! of whether our compiled back-ends actually meet the specification. 5 | 6 | pub mod read; 7 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/fathom/src/lib.rs: -------------------------------------------------------------------------------- 1 | // #![warn(rust_2018_idioms)] 2 | 3 | pub mod driver; 4 | 5 | pub mod lang; 6 | pub mod pass; 7 | 8 | mod ieee754; 9 | mod literal; 10 | pub mod reporting; 11 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/fathom/src/pass.rs: -------------------------------------------------------------------------------- 1 | //! Translation passes between the intermediate representations of the compiler. 2 | 3 | pub mod surface_to_core; 4 | pub mod surface_to_doc; 5 | pub mod surface_to_pretty; 6 | 7 | pub mod core_to_pretty; 8 | pub mod core_to_surface; 9 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/fathom/src/pass/surface_to_doc/minireset.min.css: -------------------------------------------------------------------------------- 1 | /*! minireset.css v0.0.5 | MIT License | github.com/jgthms/minireset.css */html,body,p,ol,ul,li,dl,dt,dd,blockquote,figure,fieldset,legend,textarea,pre,iframe,hr,h1,h2,h3,h4,h5,h6{margin:0;padding:0}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal}ul{list-style:none}button,input,select,textarea{margin:0}html{box-sizing:border-box}*,*:before,*:after{box-sizing:inherit}img,video{height:auto;max-width:100%}iframe{border:0}table{border-collapse:collapse;border-spacing:0}td,th{padding:0;text-align:left} 2 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/fathom/src/pass/surface_to_doc/style.css: -------------------------------------------------------------------------------- 1 | body { 2 | font-family: "Source Sans Pro", "Trebuchet MS", "Lucida Grande", 3 | "Bitstream Vera Sans", "Helvetica Neue", sans-serif; 4 | line-height: 1.4; 5 | padding: 2em; 6 | } 7 | 8 | a { 9 | text-decoration: none; 10 | } 11 | 12 | a:hover { 13 | text-decoration: underline; 14 | } 15 | 16 | dl.items > dt.item, 17 | dl.fields > dt.field, 18 | dd.constant > section.term { 19 | border-top: 1px solid #eee; 20 | padding: 0.5em 0 0.5em 0; 21 | } 22 | 23 | dl.items > dd.item, 24 | dl.fields > dd.field { 25 | margin-left: 2em; 26 | margin-bottom: 1em; 27 | } 28 | 29 | section.doc { 30 | margin-bottom: 1em; 31 | } 32 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/constant/fail_ann_mismatch.fathom: -------------------------------------------------------------------------------- 1 | const Test1 = U32Be : U8; //~ error: universe mismatch 2 | const Test2 = U32Be : (23 : Int); //~ error: universe mismatch 3 | const Test3 = U32Be : Type; //~ error: type mismatch 4 | const Test4 = Int : Format; //~ error: type mismatch 5 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/constant/fail_format_array_bad_elem.fathom: -------------------------------------------------------------------------------- 1 | const SimpleFormatArray = FormatArray 35 Int; //~ error: type mismatch 2 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/constant/fail_format_array_bad_len.fathom: -------------------------------------------------------------------------------- 1 | const SimpleFormatArray = FormatArray 0.35 U32Be; //~ error: expected a base 10 digit or digit separator 2 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/constant/fail_if_else_term_mismatched_arms.fathom: -------------------------------------------------------------------------------- 1 | const Foo : F32 = 33.4; 2 | 3 | const test : Bool = 4 | if true { 5 | true 6 | } else { 7 | Foo //~ error: type mismatch 8 | }; 9 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/constant/fail_if_else_term_mismatched_condition.fathom: -------------------------------------------------------------------------------- 1 | const test : Bool = 2 | if 33.4 { //~ error: cannot construct a `Bool` from a numeric literal 3 | true 4 | } else { 5 | false 6 | }; 7 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/constant/fail_kind_has_no_type.fathom: -------------------------------------------------------------------------------- 1 | const TestKind = Kind; //~ error: term has no type 2 | const TestType : Kind = Type; //~ error: term has no type 3 | const TestFormat : Kind = Format; //~ error: term has no type 4 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/constant/fail_match_ambiguous_scrutinee.fathom: -------------------------------------------------------------------------------- 1 | const test : Bool = 2 | match 33 { //~ error: ambiguous numeric literal 3 | 42 => true, 4 | _ => false, 5 | }; 6 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/constant/fail_match_int_ambiguous.fathom: -------------------------------------------------------------------------------- 1 | const test = 2 | match 23 : Int { 23 => true, _ => false }; //~ error: ambiguous match expression 3 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/constant/fail_match_int_missing_default.fathom: -------------------------------------------------------------------------------- 1 | const test : Int = 2 | match 23 : Int { //~ error: non-exhaustive patterns 3 | 23 => 42, 4 | }; 5 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/constant/fail_match_int_term_mismatched_arms.fathom: -------------------------------------------------------------------------------- 1 | const Foo : F32 = 33.4; 2 | 3 | const test : Bool = 4 | match 23 : Int { 5 | 23 => true, 6 | _ => Foo, //~ error: type mismatch 7 | }; 8 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/constant/fail_numeric_literal_ambiguous.fathom: -------------------------------------------------------------------------------- 1 | const Test = 1; //~ error: ambiguous numeric literal 2 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/constant/fail_numeric_literal_not_supported.fathom: -------------------------------------------------------------------------------- 1 | const Test : Bool = 33; //~ error: cannot construct a `Bool` from a numeric literal 2 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/constant/pass_ann_ann.fathom: -------------------------------------------------------------------------------- 1 | //! Test annotated annotations. 2 | 3 | const Test = (U8 : Format) : Format; 4 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/constant/pass_constant_term.fathom: -------------------------------------------------------------------------------- 1 | /// Test that one can refer to local term aliases in aliases. 2 | 3 | const Foo = true; 4 | const Bar = Foo; 5 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/constant/pass_constant_type.fathom: -------------------------------------------------------------------------------- 1 | /// Test that one can refer to local type aliases in aliases. 2 | 3 | const Foo = U32Be; 4 | const Bar = Foo; 5 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/constant/pass_format_array.fathom: -------------------------------------------------------------------------------- 1 | const SimpleFormatArray = FormatArray 6 U32Be; 2 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/constant/pass_function_types.fathom: -------------------------------------------------------------------------------- 1 | // PTS rules 2 | 3 | const TypeType = Int -> Int : Type; // (Type, Type, Type) 4 | const TypeKind = Int -> Type; // (Type, Kind, Kind) 5 | const KindType = Type -> Int; // (Kind, Type, Kind) 6 | const KindKind = Type -> Type; // (Kind, Kind, Kind) 7 | 8 | // Common types 9 | 10 | const ListType = Type -> Type; 11 | const ArrayType = Int -> Type -> Type; 12 | const ListFormat = Format -> Format; 13 | const ArrayFormat = Int -> Format -> Format; 14 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/constant/pass_if_else_ann_type.fathom: -------------------------------------------------------------------------------- 1 | const Test : if true { F64 } else { Bool } = 0.1; 2 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/constant/pass_if_else_format_type.fathom: -------------------------------------------------------------------------------- 1 | const Test : Format = 2 | if true { F64Be } else { F32Be }; 3 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/constant/pass_if_else_format_type_item.fathom: -------------------------------------------------------------------------------- 1 | const foo = 2 | true; 3 | 4 | const Test : Format = 5 | if foo { F64Be } else { F32Be }; 6 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/constant/pass_if_else_host_type.fathom: -------------------------------------------------------------------------------- 1 | const Test : Type = 2 | if true { 3 | F64 4 | } else { 5 | F32 6 | }; 7 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/constant/pass_if_else_host_type_item.fathom: -------------------------------------------------------------------------------- 1 | const foo = 2 | true; 3 | 4 | const Test : Type = 5 | if foo { 6 | F64 7 | } else { 8 | F32 9 | }; 10 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/constant/pass_if_else_if_else_format_type.fathom: -------------------------------------------------------------------------------- 1 | const Test : Format = 2 | if true { 3 | if true { F64Be } else { F32Be } 4 | } else { 5 | if false { F64Be } else { F32Be } 6 | }; 7 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/constant/pass_if_else_term.fathom: -------------------------------------------------------------------------------- 1 | const test : Bool = 2 | if true { true } else { false }; 3 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/constant/pass_if_else_term_item.fathom: -------------------------------------------------------------------------------- 1 | const foo = 2 | true; 3 | 4 | const bar : Bool = 5 | if foo { true } else { false }; 6 | 7 | const baz = bar; 8 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/constant/pass_match_int_ann_type.fathom: -------------------------------------------------------------------------------- 1 | const Test : (match 23 : Int { 0 => F64, _ => Bool } : Type) = true; 2 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/constant/pass_match_int_format_type.fathom: -------------------------------------------------------------------------------- 1 | const Test : Format = 2 | match 0 : Int { 3 | 0 => F64Le, 4 | _ => F64Be, 5 | }; 6 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/constant/pass_match_int_format_type_item.fathom: -------------------------------------------------------------------------------- 1 | const foo : Int = 0; 2 | 3 | const Test : Format = 4 | match foo { 5 | 0 => F64Le, 6 | _ => F64Be, 7 | }; 8 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/constant/pass_match_int_host_type.fathom: -------------------------------------------------------------------------------- 1 | const Test : Type = 2 | match 42 : Int { 3 | 0 => F64, 4 | _ => F32, 5 | }; 6 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/constant/pass_match_int_host_type_item.fathom: -------------------------------------------------------------------------------- 1 | const foo : Int = 2 | 43; 3 | 4 | const Test : Type = 5 | match foo { 6 | 42 => F64, 7 | _ => F32, 8 | }; 9 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/constant/pass_match_int_term.fathom: -------------------------------------------------------------------------------- 1 | const test : Bool = 2 | match 33 : Int { 3 | 33 => true, 4 | 42 => false, 5 | _ => false, 6 | }; 7 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/constant/pass_match_int_term_item.fathom: -------------------------------------------------------------------------------- 1 | const foo : Int = 33; 2 | 3 | const bar : Bool = 4 | match foo { 5 | 33 => true, 6 | 42 => false, 7 | _ => false, 8 | }; 9 | 10 | const baz = bar; 11 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/constant/pass_match_int_term_unreachable.fathom: -------------------------------------------------------------------------------- 1 | const test : Bool = 2 | match 33 : Int { 3 | 33 => true, 4 | 33 => true, //~ warning: unreachable pattern 5 | 42 => false, 6 | foo => false, 7 | _ => false, //~ warning: unreachable pattern 8 | }; 9 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/constant/pass_simple.fathom: -------------------------------------------------------------------------------- 1 | //! Test simple aliases. 2 | 3 | const Byte = U8; 4 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/constant/pass_simple_doc.fathom: -------------------------------------------------------------------------------- 1 | //! Test constants with doc comments. 2 | 3 | /// A 8-bit long unit of information. 4 | const Byte = U8; 5 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/constant/sequence_term.fathom: -------------------------------------------------------------------------------- 1 | const good_array : Array 3 Int = [0, 0, 0]; 2 | 3 | const mismatched_array_length : Array 3 Int = [0, 0]; //~ error: mismatched array length 4 | const no_sequence_term : Int = [0, 0]; //~ error: unexpected sequence term 5 | const ambiguous_sequence = []; //~ error: ambiguous sequence term 6 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/constant/snapshots/fail_ann_mismatch.core.fathom: -------------------------------------------------------------------------------- 1 | const Test1 = !; 2 | 3 | const Test2 = !; 4 | 5 | const Test3 = ! : Type; 6 | 7 | const Test4 = ! : Format; 8 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/constant/snapshots/fail_format_array_bad_elem.core.fathom: -------------------------------------------------------------------------------- 1 | const SimpleFormatArray = (global FormatArray int 35) !; 2 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/constant/snapshots/fail_format_array_bad_len.core.fathom: -------------------------------------------------------------------------------- 1 | const SimpleFormatArray = (global FormatArray !) global U32Be; 2 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/constant/snapshots/fail_if_else_term_mismatched_arms.core.fathom: -------------------------------------------------------------------------------- 1 | const Foo = f32 33.4 : global F32; 2 | 3 | const test = bool_elim global true { global true, ! } : global Bool; 4 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/constant/snapshots/fail_if_else_term_mismatched_condition.core.fathom: -------------------------------------------------------------------------------- 1 | const test = bool_elim ! { global true, global false } : global Bool; 2 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/constant/snapshots/fail_kind_has_no_type.core.fathom: -------------------------------------------------------------------------------- 1 | const TestKind = !; 2 | 3 | const TestType = !; 4 | 5 | const TestFormat = !; 6 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/constant/snapshots/fail_match_ambiguous_scrutinee.core.fathom: -------------------------------------------------------------------------------- 1 | const test = ! : global Bool; 2 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/constant/snapshots/fail_match_int_ambiguous.core.fathom: -------------------------------------------------------------------------------- 1 | const test = !; 2 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/constant/snapshots/fail_match_int_missing_default.core.fathom: -------------------------------------------------------------------------------- 1 | const test = int_elim int 23 : global Int { 23 => int 42, ! } : global Int; 2 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/constant/snapshots/fail_match_int_term_mismatched_arms.core.fathom: -------------------------------------------------------------------------------- 1 | const Foo = f32 33.4 : global F32; 2 | 3 | const test = int_elim int 23 : global Int { 23 => global true, ! } : global Bool; 4 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/constant/snapshots/fail_numeric_literal_ambiguous.core.fathom: -------------------------------------------------------------------------------- 1 | const Test = !; 2 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/constant/snapshots/fail_numeric_literal_not_supported.core.fathom: -------------------------------------------------------------------------------- 1 | const Test = ! : global Bool; 2 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/constant/snapshots/pass_ann_ann.core.fathom: -------------------------------------------------------------------------------- 1 | //! Test annotated annotations. 2 | 3 | const Test = (global U8 : Format) : Format; 4 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/constant/snapshots/pass_constant_term.core.fathom: -------------------------------------------------------------------------------- 1 | /// Test that one can refer to local term aliases in aliases. 2 | const Foo = global true; 3 | 4 | const Bar = item Foo; 5 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/constant/snapshots/pass_constant_type.core.fathom: -------------------------------------------------------------------------------- 1 | /// Test that one can refer to local type aliases in aliases. 2 | const Foo = global U32Be; 3 | 4 | const Bar = item Foo; 5 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/constant/snapshots/pass_format_array.core.fathom: -------------------------------------------------------------------------------- 1 | const SimpleFormatArray = (global FormatArray int 6) global U32Be; 2 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/constant/snapshots/pass_function_types.core.fathom: -------------------------------------------------------------------------------- 1 | const TypeType = global Int -> global Int : Type; 2 | 3 | const TypeKind = global Int -> Type; 4 | 5 | const KindType = Type -> global Int; 6 | 7 | const KindKind = Type -> Type; 8 | 9 | const ListType = Type -> Type; 10 | 11 | const ArrayType = global Int -> Type -> Type; 12 | 13 | const ListFormat = Format -> Format; 14 | 15 | const ArrayFormat = global Int -> Format -> Format; 16 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/constant/snapshots/pass_if_else_ann_type.core.fathom: -------------------------------------------------------------------------------- 1 | const Test = f64 0.1 : bool_elim global true { global F64, global Bool }; 2 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/constant/snapshots/pass_if_else_format_type.core.fathom: -------------------------------------------------------------------------------- 1 | const Test = bool_elim global true { global F64Be, global F32Be } : Format; 2 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/constant/snapshots/pass_if_else_format_type_item.core.fathom: -------------------------------------------------------------------------------- 1 | const foo = global true; 2 | 3 | const Test = bool_elim item foo { global F64Be, global F32Be } : Format; 4 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/constant/snapshots/pass_if_else_host_type.core.fathom: -------------------------------------------------------------------------------- 1 | const Test = bool_elim global true { global F64, global F32 } : Type; 2 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/constant/snapshots/pass_if_else_host_type_item.core.fathom: -------------------------------------------------------------------------------- 1 | const foo = global true; 2 | 3 | const Test = bool_elim item foo { global F64, global F32 } : Type; 4 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/constant/snapshots/pass_if_else_if_else_format_type.core.fathom: -------------------------------------------------------------------------------- 1 | const Test = bool_elim global true { bool_elim global true { global F64Be, global F32Be }, bool_elim global false { global F64Be, global F32Be } } : Format; 2 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/constant/snapshots/pass_if_else_term.core.fathom: -------------------------------------------------------------------------------- 1 | const test = bool_elim global true { global true, global false } : global Bool; 2 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/constant/snapshots/pass_if_else_term_item.core.fathom: -------------------------------------------------------------------------------- 1 | const foo = global true; 2 | 3 | const bar = bool_elim item foo { global true, global false } : global Bool; 4 | 5 | const baz = item bar; 6 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/constant/snapshots/pass_match_int_ann_type.core.fathom: -------------------------------------------------------------------------------- 1 | const Test = global true : int_elim int 23 : global Int { 0 => global F64, global Bool } : Type; 2 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/constant/snapshots/pass_match_int_format_type.core.fathom: -------------------------------------------------------------------------------- 1 | const Test = int_elim int 0 : global Int { 0 => global F64Le, global F64Be } : Format; 2 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/constant/snapshots/pass_match_int_format_type_item.core.fathom: -------------------------------------------------------------------------------- 1 | const foo = int 0 : global Int; 2 | 3 | const Test = int_elim item foo { 0 => global F64Le, global F64Be } : Format; 4 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/constant/snapshots/pass_match_int_host_type.core.fathom: -------------------------------------------------------------------------------- 1 | const Test = int_elim int 42 : global Int { 0 => global F64, global F32 } : Type; 2 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/constant/snapshots/pass_match_int_host_type_item.core.fathom: -------------------------------------------------------------------------------- 1 | const foo = int 43 : global Int; 2 | 3 | const Test = int_elim item foo { 42 => global F64, global F32 } : Type; 4 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/constant/snapshots/pass_match_int_term.core.fathom: -------------------------------------------------------------------------------- 1 | const test = int_elim int 33 : global Int { 33 => global true, 42 => global false, global false } : global Bool; 2 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/constant/snapshots/pass_match_int_term_item.core.fathom: -------------------------------------------------------------------------------- 1 | const foo = int 33 : global Int; 2 | 3 | const bar = int_elim item foo { 33 => global true, 42 => global false, global false } : global Bool; 4 | 5 | const baz = item bar; 6 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/constant/snapshots/pass_match_int_term_unreachable.core.fathom: -------------------------------------------------------------------------------- 1 | const test = int_elim int 33 : global Int { 33 => global true, 42 => global false, global false } : global Bool; 2 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/constant/snapshots/pass_simple.core.fathom: -------------------------------------------------------------------------------- 1 | //! Test simple aliases. 2 | 3 | const Byte = global U8; 4 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/constant/snapshots/pass_simple_doc.core.fathom: -------------------------------------------------------------------------------- 1 | //! Test constants with doc comments. 2 | 3 | /// A 8-bit long unit of information. 4 | const Byte = global U8; 5 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/constant/snapshots/sequence_term.core.fathom: -------------------------------------------------------------------------------- 1 | const good_array = array [int 0, int 0, int 0] : (global Array int 3) global Int; 2 | 3 | const mismatched_array_length = ! : (global Array int 3) global Int; 4 | 5 | const no_sequence_term = ! : global Int; 6 | 7 | const ambiguous_sequence = !; 8 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/fail_duplicate_definitions.fathom: -------------------------------------------------------------------------------- 1 | struct Empty : Format {} 2 | struct Empty : Format {} //~ error: the name `Empty` is defined multiple times 3 | struct Empty : Format {} //~ error: the name `Empty` is defined multiple times 4 | const Empty = 1 : Int; //~ error: the name `Empty` is defined multiple times 5 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/fail_invalid_token.fathom: -------------------------------------------------------------------------------- 1 | @ //~ error: invalid token 2 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/fail_unexpected_token.fathom: -------------------------------------------------------------------------------- 1 | ; //~ error: unexpected token 2 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/pass_empty.fathom: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yeslogic/fathom/3960a9466150d392c2cb103c5cb5fcffa0200814/experiments/rust-prototype-v3/tests/pass_empty.fathom -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/pass_empty_doc.fathom: -------------------------------------------------------------------------------- 1 | //! This is an empty module. 2 | //! 3 | //! It is quite empty, yes. 4 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/snapshots/fail_duplicate_definitions.core.fathom: -------------------------------------------------------------------------------- 1 | struct Empty : Format {} 2 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/snapshots/fail_invalid_token.core.fathom: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/snapshots/fail_unexpected_token.core.fathom: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/snapshots/pass_empty.core.fathom: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/snapshots/pass_empty_doc.core.fathom: -------------------------------------------------------------------------------- 1 | //! This is an empty module. 2 | //! 3 | //! It is quite empty, yes. 4 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/struct/fail_duplicate_fields.fathom: -------------------------------------------------------------------------------- 1 | struct PairType : Type { 2 | first : Int, 3 | second : Int, 4 | first : Int, //~ error: field `first` is already declared 5 | first : Int, //~ error: field `first` is already declared 6 | second : Int, //~ error: field `second` is already declared 7 | } 8 | 9 | struct PairFormat : Format { 10 | first : U8, 11 | second : U8, 12 | first : U8, //~ error: field `first` is already declared 13 | first : U8, //~ error: field `first` is already declared 14 | second : U8, //~ error: field `second` is already declared 15 | } 16 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/struct/fail_field_type_mismatch.fathom: -------------------------------------------------------------------------------- 1 | struct FooType : Type { 2 | field_kind : Kind, //~ error: term has no type 3 | field_type : Type, //~ error: type mismatch 4 | field_format : Format, //~ error: type mismatch 5 | field_u32be : U32Be, //~ error: type mismatch 6 | } 7 | 8 | struct FooFormat : Format { 9 | field_kind : Kind, //~ error: term has no type 10 | field_type : Type, //~ error: type mismatch 11 | field_format : Format, //~ error: type mismatch 12 | field_true : true, //~ error: type mismatch 13 | field_false : true, //~ error: type mismatch 14 | } 15 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/struct/fail_invalid_ann.fathom: -------------------------------------------------------------------------------- 1 | struct Test : Int {} //~ error: invalid type annotation for struct `Test` 2 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/struct/fail_missing_ann.fathom: -------------------------------------------------------------------------------- 1 | struct Test {} //~ error: missing type annotation for struct `Test` 2 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/struct/fail_missing_closing_brace.fathom: -------------------------------------------------------------------------------- 1 | struct Empty : Format { //~ error: unexpected end of file 2 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/struct/fail_missing_fields.fathom: -------------------------------------------------------------------------------- 1 | struct Empty //~ error: unexpected end of file 2 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/struct/fail_missing_name.fathom: -------------------------------------------------------------------------------- 1 | struct //~ error: unexpected end of file 2 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/struct/fail_undefined_field.fathom: -------------------------------------------------------------------------------- 1 | struct Pair : Format { 2 | first : Bloop, //~ error: cannot find `Bloop` in this scope 3 | second : Bloop, //~ error: cannot find `Bloop` in this scope 4 | } 5 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/struct/pass_empty.fathom: -------------------------------------------------------------------------------- 1 | //! Test an empty struct. 2 | 3 | struct EmptyType : Type {} 4 | struct EmptyFormat : Format {} 5 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/struct/pass_empty_doc.fathom: -------------------------------------------------------------------------------- 1 | //! Test an empty struct with documentation. 2 | 3 | /// This is an empty struct. 4 | struct EmptyType : Type {} 5 | 6 | /// This is an empty struct format. 7 | /// 8 | /// It will not consume any input. 9 | struct EmptyFormat : Format {} 10 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/struct/pass_pair.fathom: -------------------------------------------------------------------------------- 1 | //! Test pair structs. 2 | 3 | /// A pair of integers. 4 | struct PairType : Type { 5 | /// The first field. 6 | first : Int, 7 | /// The second field. 8 | second : Int, 9 | } 10 | 11 | /// A pair of bytes. 12 | struct PairFormat : Format { 13 | /// The first field. 14 | first : U8, 15 | /// The second field. 16 | second : S8, 17 | } 18 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/struct/pass_singleton.fathom: -------------------------------------------------------------------------------- 1 | //! Test singleton structs. 2 | 3 | struct Singleton : Type { 4 | inner : Int, 5 | } 6 | 7 | struct Byte : Format { 8 | inner : U8, 9 | } 10 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/struct/pass_var.fathom: -------------------------------------------------------------------------------- 1 | //! Test referring to constants in struct fields. 2 | 3 | struct Pair: Format { 4 | first : U8, 5 | second : U8, 6 | } 7 | 8 | const MyPair = Pair; 9 | 10 | struct PairPair : Format { 11 | first : Pair, 12 | second : MyPair, 13 | } 14 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/struct/positions.fathom: -------------------------------------------------------------------------------- 1 | //! A chunky format. 2 | //! 3 | //! Tests `CurrentPos` and `Link`. 4 | 5 | struct Chunk : Format { 6 | start : CurrentPos, 7 | width : U16Be, 8 | height : U16Be, 9 | } 10 | 11 | struct Root : Format { 12 | start : CurrentPos, 13 | magic : FormatArray 4 U8, 14 | offset1 : U16Be, 15 | offset2 : U16Be, 16 | position1 : Link start offset1 Chunk, 17 | position2 : Link start offset2 Chunk, 18 | } 19 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/struct/snapshots/fail_duplicate_fields.core.fathom: -------------------------------------------------------------------------------- 1 | struct PairType : Type { 2 | first : global Int, 3 | second : global Int, 4 | } 5 | 6 | struct PairFormat : Format { 7 | first : global U8, 8 | second : global U8, 9 | } 10 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/struct/snapshots/fail_field_type_mismatch.core.fathom: -------------------------------------------------------------------------------- 1 | struct FooType : Type { 2 | field_kind : !, 3 | field_type : !, 4 | field_format : !, 5 | field_u32be : !, 6 | } 7 | 8 | struct FooFormat : Format { 9 | field_kind : !, 10 | field_type : !, 11 | field_format : !, 12 | field_true : !, 13 | field_false : !, 14 | } 15 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/struct/snapshots/fail_invalid_ann.core.fathom: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/struct/snapshots/fail_missing_ann.core.fathom: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/struct/snapshots/fail_missing_closing_brace.core.fathom: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/struct/snapshots/fail_missing_fields.core.fathom: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/struct/snapshots/fail_missing_name.core.fathom: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/struct/snapshots/fail_undefined_field.core.fathom: -------------------------------------------------------------------------------- 1 | struct Pair : Format { 2 | first : !, 3 | second : !, 4 | } 5 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/struct/snapshots/pass_empty.core.fathom: -------------------------------------------------------------------------------- 1 | //! Test an empty struct. 2 | 3 | struct EmptyType : Type {} 4 | 5 | struct EmptyFormat : Format {} 6 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/struct/snapshots/pass_empty_doc.core.fathom: -------------------------------------------------------------------------------- 1 | //! Test an empty struct with documentation. 2 | 3 | /// This is an empty struct. 4 | struct EmptyType : Type {} 5 | 6 | /// This is an empty struct format. 7 | /// 8 | /// It will not consume any input. 9 | struct EmptyFormat : Format {} 10 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/struct/snapshots/pass_pair.core.fathom: -------------------------------------------------------------------------------- 1 | //! Test pair structs. 2 | 3 | /// A pair of integers. 4 | struct PairType : Type { 5 | /// The first field. 6 | first : global Int, 7 | /// The second field. 8 | second : global Int, 9 | } 10 | 11 | /// A pair of bytes. 12 | struct PairFormat : Format { 13 | /// The first field. 14 | first : global U8, 15 | /// The second field. 16 | second : global S8, 17 | } 18 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/struct/snapshots/pass_singleton.core.fathom: -------------------------------------------------------------------------------- 1 | //! Test singleton structs. 2 | 3 | struct Singleton : Type { 4 | inner : global Int, 5 | } 6 | 7 | struct Byte : Format { 8 | inner : global U8, 9 | } 10 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/struct/snapshots/pass_var.core.fathom: -------------------------------------------------------------------------------- 1 | //! Test referring to constants in struct fields. 2 | 3 | struct Pair : Format { 4 | first : global U8, 5 | second : global U8, 6 | } 7 | 8 | const MyPair = item Pair; 9 | 10 | struct PairPair : Format { 11 | first : item Pair, 12 | second : item MyPair, 13 | } 14 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/struct/snapshots/positions.core.fathom: -------------------------------------------------------------------------------- 1 | //! A chunky format. 2 | //! 3 | //! Tests `CurrentPos` and `Link`. 4 | 5 | struct Chunk : Format { 6 | start : global CurrentPos, 7 | width : global U16Be, 8 | height : global U16Be, 9 | } 10 | 11 | struct Root : Format { 12 | start : global CurrentPos, 13 | magic : (global FormatArray int 4) global U8, 14 | offset1 : global U16Be, 15 | offset2 : global U16Be, 16 | position1 : ((global Link local 3) local 1) item Chunk, 17 | position2 : ((global Link local 4) local 1) item Chunk, 18 | } 19 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/struct/snapshots/struct_compute.core.fathom: -------------------------------------------------------------------------------- 1 | struct Header : Type { 2 | count : global Int, 3 | } 4 | 5 | const header_example = struct { 6 | count = int 4, 7 | } : item Header; 8 | 9 | const Data = (global Array (item header_example).count) global Int : Type; 10 | -------------------------------------------------------------------------------- /experiments/rust-prototype-v3/tests/struct/struct_compute.fathom: -------------------------------------------------------------------------------- 1 | struct Header : Type { 2 | count : Int, 3 | } 4 | 5 | const header_example : Header = struct { 6 | count = 4, 7 | }; 8 | 9 | const Data : Type = Array header_example.count Int; 10 | 11 | // TODO: data : Data = [0, 1, 2, 3]; 12 | -------------------------------------------------------------------------------- /fathom/build.rs: -------------------------------------------------------------------------------- 1 | fn main() -> Result<(), Box> { 2 | lalrpop::Configuration::new() 3 | .always_use_colors() 4 | .process_current_dir() 5 | } 6 | -------------------------------------------------------------------------------- /fathom/src/lib.rs: -------------------------------------------------------------------------------- 1 | #![doc = include_str!("../../README.md")] 2 | #![allow(clippy::bool_assert_comparison)] 3 | #![allow(clippy::len_without_is_empty)] 4 | #![allow(clippy::new_without_default)] 5 | 6 | // Supporting modules 7 | mod alloc; 8 | pub mod env; 9 | pub mod files; 10 | pub mod source; 11 | pub mod symbol; 12 | 13 | // Intermediate languages 14 | pub mod core; 15 | pub mod surface; 16 | 17 | // Top level driver 18 | mod driver; 19 | 20 | pub const BUG_REPORT_URL: &str = concat!(env!("CARGO_PKG_REPOSITORY"), "/issues/new"); 21 | 22 | // Public exports 23 | pub use driver::{Driver, Status}; 24 | -------------------------------------------------------------------------------- /fathom/tests/cli_tests.rs: -------------------------------------------------------------------------------- 1 | /// Command line integration tests, run with the [trycmd] crate. 2 | 3 | #[test] 4 | fn cli_tests() { 5 | std::env::set_current_dir("..").unwrap(); 6 | trycmd::TestCases::new().case("tests/cmd/*.md"); 7 | } 8 | -------------------------------------------------------------------------------- /formats/README.md: -------------------------------------------------------------------------------- 1 | # Binary formats 2 | 3 | This is a collection of binary formats described using the Fathom data 4 | description language. 5 | 6 | These formats are tested using [../fathom/tests/source_tests.rs](../fathom/tests/source_tests.rs). 7 | -------------------------------------------------------------------------------- /formats/data/edid/dell-P2415Q.edid: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yeslogic/fathom/3960a9466150d392c2cb103c5cb5fcffa0200814/formats/data/edid/dell-P2415Q.edid -------------------------------------------------------------------------------- /formats/data/edid/invalid/wrong-magic.edid: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yeslogic/fathom/3960a9466150d392c2cb103c5cb5fcffa0200814/formats/data/edid/invalid/wrong-magic.edid -------------------------------------------------------------------------------- /formats/data/edid/invalid/wrong-magic.snap: -------------------------------------------------------------------------------- 1 | stdout = '' 2 | stderr = ''' 3 | error: conditional format failed 4 | ┌─ formats/edid.fathom:18:26 5 | │ 6 | 18 │ magic <- u64le where u64_eq magic 0x00ffffffffffff00, 7 | │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 8 | │ 9 | = The predicate on a conditional format did not succeed. 10 | = failed value: 18374686479671623935 11 | 12 | ''' 13 | -------------------------------------------------------------------------------- /formats/data/opentype/aots/README.md: -------------------------------------------------------------------------------- 1 | AOTS Test Fonts 2 | =============== 3 | 4 | The fonts in this sub-directory are from Adobe's [Annotated OpenType Specification][aots]. 5 | Licensed under the Apache-2.0 license. 6 | 7 | [aots]: https://github.com/adobe-type-tools/aots/tree/0ffdb7a13e73ffcecd351941998cbf009b8b1bba 8 | -------------------------------------------------------------------------------- /formats/data/opentype/aots/cmap0_font1.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yeslogic/fathom/3960a9466150d392c2cb103c5cb5fcffa0200814/formats/data/opentype/aots/cmap0_font1.otf -------------------------------------------------------------------------------- /formats/data/opentype/aots/cmap10_font1.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yeslogic/fathom/3960a9466150d392c2cb103c5cb5fcffa0200814/formats/data/opentype/aots/cmap10_font1.otf -------------------------------------------------------------------------------- /formats/data/opentype/aots/cmap10_font2.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yeslogic/fathom/3960a9466150d392c2cb103c5cb5fcffa0200814/formats/data/opentype/aots/cmap10_font2.otf -------------------------------------------------------------------------------- /formats/data/opentype/aots/cmap12_font1.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yeslogic/fathom/3960a9466150d392c2cb103c5cb5fcffa0200814/formats/data/opentype/aots/cmap12_font1.otf -------------------------------------------------------------------------------- /formats/data/opentype/aots/cmap14_font1.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yeslogic/fathom/3960a9466150d392c2cb103c5cb5fcffa0200814/formats/data/opentype/aots/cmap14_font1.otf -------------------------------------------------------------------------------- /formats/data/opentype/aots/cmap2_font1.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yeslogic/fathom/3960a9466150d392c2cb103c5cb5fcffa0200814/formats/data/opentype/aots/cmap2_font1.otf -------------------------------------------------------------------------------- /formats/data/opentype/aots/cmap4_font1.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yeslogic/fathom/3960a9466150d392c2cb103c5cb5fcffa0200814/formats/data/opentype/aots/cmap4_font1.otf -------------------------------------------------------------------------------- /formats/data/opentype/aots/cmap4_font2.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yeslogic/fathom/3960a9466150d392c2cb103c5cb5fcffa0200814/formats/data/opentype/aots/cmap4_font2.otf -------------------------------------------------------------------------------- /formats/data/opentype/aots/cmap4_font3.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yeslogic/fathom/3960a9466150d392c2cb103c5cb5fcffa0200814/formats/data/opentype/aots/cmap4_font3.otf -------------------------------------------------------------------------------- /formats/data/opentype/aots/cmap4_font4.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yeslogic/fathom/3960a9466150d392c2cb103c5cb5fcffa0200814/formats/data/opentype/aots/cmap4_font4.otf -------------------------------------------------------------------------------- /formats/data/opentype/aots/cmap6_font1.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yeslogic/fathom/3960a9466150d392c2cb103c5cb5fcffa0200814/formats/data/opentype/aots/cmap6_font1.otf -------------------------------------------------------------------------------- /formats/data/opentype/aots/cmap6_font2.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yeslogic/fathom/3960a9466150d392c2cb103c5cb5fcffa0200814/formats/data/opentype/aots/cmap6_font2.otf -------------------------------------------------------------------------------- /formats/data/opentype/aots/cmap8_font1.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yeslogic/fathom/3960a9466150d392c2cb103c5cb5fcffa0200814/formats/data/opentype/aots/cmap8_font1.otf -------------------------------------------------------------------------------- /formats/data/opentype/woff/valid-001.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yeslogic/fathom/3960a9466150d392c2cb103c5cb5fcffa0200814/formats/data/opentype/woff/valid-001.ttf -------------------------------------------------------------------------------- /formats/data/opentype/woff/valid-005.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yeslogic/fathom/3960a9466150d392c2cb103c5cb5fcffa0200814/formats/data/opentype/woff/valid-005.ttf -------------------------------------------------------------------------------- /formats/data/opentype/woff2/SFNT-TTF-Composite.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yeslogic/fathom/3960a9466150d392c2cb103c5cb5fcffa0200814/formats/data/opentype/woff2/SFNT-TTF-Composite.ttf -------------------------------------------------------------------------------- /formats/data/stl-binary/cube.stl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yeslogic/fathom/3960a9466150d392c2cb103c5cb5fcffa0200814/formats/data/stl-binary/cube.stl -------------------------------------------------------------------------------- /formats/gif.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | def logical_screen_descriptor : Format = { 3 | image_width <- u16le, 4 | image_height <- u16le, 5 | flags <- u8, 6 | bg_color_index <- u8, 7 | pixel_aspect_ratio <- u8, 8 | }; 9 | def header : Format = { 10 | magic <- repeat_len8 3 u8, 11 | version <- repeat_len8 3 u8, 12 | }; 13 | def color_table_entry : Format = { red <- u8, green <- u8, blue <- u8 }; 14 | def global_color_table : U16 -> Format = fun len => { 15 | entries <- repeat_len16 len color_table_entry, 16 | }; 17 | def main : Format = { header <- header, screen <- logical_screen_descriptor }; 18 | ''' 19 | stderr = '' 20 | -------------------------------------------------------------------------------- /formats/icns.fathom: -------------------------------------------------------------------------------- 1 | //! # Apple Icon Image format 2 | //! 3 | //! ## References 4 | //! 5 | //! - [Wikipedia](https://en.wikipedia.org/wiki/Apple_Icon_Image_format) 6 | 7 | def header = { 8 | magic <- u32be where u32_eq magic "icns", 9 | file_length <- u32be, 10 | }; 11 | 12 | def icon_data = { 13 | icon_type <- u32be, // TODO: bit patterns 14 | icon_data_length <- u32be, 15 | // TODO: decode data based on `icon_type` 16 | data <- limit32 icon_data_length (repeat_until_end u8), 17 | }; 18 | 19 | def main = { 20 | header <- header, 21 | icons <- repeat_until_end icon_data, 22 | }; 23 | -------------------------------------------------------------------------------- /formats/icns.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | def header : Format = { 3 | magic <- u32be where magic == ("icns" : U32), 4 | file_length <- u32be, 5 | }; 6 | def icon_data : Format = { 7 | icon_type <- u32be, 8 | icon_data_length <- u32be, 9 | data <- limit32 icon_data_length (repeat_until_end u8), 10 | }; 11 | def main : Format = { header <- header, icons <- repeat_until_end icon_data }; 12 | ''' 13 | stderr = '' 14 | -------------------------------------------------------------------------------- /formats/image.fathom: -------------------------------------------------------------------------------- 1 | //! A simple image data format. 2 | 3 | def pixel = { 4 | /// Red value. 5 | red <- s32be, 6 | /// Green value. 7 | green <- s32be, 8 | /// Blue value. 9 | blue <- s32be, 10 | }; 11 | 12 | def main = { 13 | /// The width of the image, in pixels. 14 | width <- u32be, 15 | /// The height of the image, in pixels. 16 | height <- u32be, 17 | /// The pixel data. 18 | pixels <- repeat_len32 (width * height) pixel, 19 | }; 20 | -------------------------------------------------------------------------------- /formats/image.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | def pixel : Format = { red <- s32be, green <- s32be, blue <- s32be }; 3 | def main : Format = { 4 | width <- u32be, 5 | height <- u32be, 6 | pixels <- repeat_len32 (width * height) pixel, 7 | }; 8 | ''' 9 | stderr = '' 10 | -------------------------------------------------------------------------------- /formats/object-id.fathom: -------------------------------------------------------------------------------- 1 | //! # BSON ObjectId 2 | //! 3 | //! ## References 4 | //! 5 | //! - [Mongo Reference](https://docs.mongodb.com/manual/reference/bson-types/#objectid) 6 | 7 | // TODO: make this a primitive 8 | def u24be = repeat_len8 3 u8; 9 | 10 | def main = { 11 | /// 4-byte timestamp value representing the creation time of the ObjectId, 12 | /// measured in seconds since the Unix epoch. 13 | timestamp <- u32be, 14 | /// Random value generated once per process. This random value is unique to 15 | /// the machine and process. 16 | random <- repeat_len8 5 u8, 17 | /// Incrementing counter, initialized to a random value. 18 | counter <- u24be, 19 | }; 20 | -------------------------------------------------------------------------------- /formats/object-id.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | def u24be : Format = repeat_len8 3 u8; 3 | def main : Format = { 4 | timestamp <- u32be, 5 | random <- repeat_len8 5 u8, 6 | counter <- u24be, 7 | }; 8 | ''' 9 | stderr = '' 10 | -------------------------------------------------------------------------------- /formats/stl-binary.fathom: -------------------------------------------------------------------------------- 1 | //! Binary STL File 2 | //! 3 | //! # References 4 | //! 5 | //! - [Wikipedia](https://en.wikipedia.org/wiki/STL_(file_format)#Binary_STL) 6 | 7 | //~ example-data = [ 8 | //~ "data/stl-binary/*.stl", 9 | //~ ] 10 | 11 | // TODO: STL variants: 12 | // - VisCAM 13 | // - SolidView 14 | // - Materialise Magics 15 | 16 | def vec3d = { 17 | x <- f32le, 18 | y <- f32le, 19 | z <- f32le, 20 | }; 21 | 22 | def triangle = { 23 | normal <- vec3d, 24 | vertices <- repeat_len8 3 vec3d, 25 | attribute_byte_count <- u16le, 26 | }; 27 | 28 | def main = { 29 | header <- repeat_len8 80 u8, 30 | triangle_count <- u32le, 31 | triangles <- repeat_len32 triangle_count triangle, 32 | }; 33 | -------------------------------------------------------------------------------- /formats/stl-binary.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | def vec3d : Format = { x <- f32le, y <- f32le, z <- f32le }; 3 | def triangle : Format = { 4 | normal <- vec3d, 5 | vertices <- repeat_len8 3 vec3d, 6 | attribute_byte_count <- u16le, 7 | }; 8 | def main : Format = { 9 | header <- repeat_len8 80 u8, 10 | triangle_count <- u32le, 11 | triangles <- repeat_len32 triangle_count triangle, 12 | }; 13 | ''' 14 | stderr = '' 15 | -------------------------------------------------------------------------------- /formats/unwrap-none.fathom: -------------------------------------------------------------------------------- 1 | def main = { 2 | let ary : Array16 3 U16 = [1, 2, 3], 3 | x <- unwrap (array16_find (fun (el : U16) => el == (4 : U16)) ary), 4 | }; 5 | -------------------------------------------------------------------------------- /formats/unwrap-none.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | def main : Format = { 3 | let ary : Array16 3 U16 = [1, 2, 3], 4 | x <- unwrap @U16 (array16_find @3 @U16 (fun el => el == (4 : U16)) ary), 5 | }; 6 | ''' 7 | stderr = '' 8 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "workspaces": [ 4 | "experiments/makam-spec" 5 | ] 6 | } 7 | -------------------------------------------------------------------------------- /rustfmt.toml: -------------------------------------------------------------------------------- 1 | format_code_in_doc_comments = true 2 | group_imports = "StdExternalCrate" 3 | imports_granularity = "module" 4 | wrap_comments = true 5 | -------------------------------------------------------------------------------- /tests/README.md: -------------------------------------------------------------------------------- 1 | # Integration tests 2 | 3 | The harnesses for each subdirectory can be found at: 4 | 5 | - [cmd](./cmd) → [../fathom/tests/cli_tests.rs](../fathom/tests/cli_tests.rs) 6 | - [fail](./fail) → [../fathom/tests/source_tests.rs](../fathom/tests/source_tests.rs) 7 | - [succeed](./succeed) → [../fathom/tests/source_tests.rs](../fathom/tests/source_tests.rs) 8 | -------------------------------------------------------------------------------- /tests/cmd/README.md: -------------------------------------------------------------------------------- 1 | # Command line snapshot tests 2 | 3 | These snapshot tests leverage [trycmd][trycmd-crate] test harness. More 4 | information on writing and running these tests can be found by reading the 5 | [trycmd docs][trycmd-docs]. If test snapshots need to be updated, rerunning the 6 | tests with `TRYCMD=overwrite` will regenerate them: 7 | 8 | ```sh 9 | TRYCMD=overwrite cargo test cli_tests 10 | ``` 11 | 12 | [trycmd-crate]: https://crates.io/crates/trycmd 13 | [trycmd-docs]: https://docs.rs/trycmd/latest/trycmd 14 | -------------------------------------------------------------------------------- /tests/fail/elaboration/ambiguous-array-literal.fathom: -------------------------------------------------------------------------------- 1 | //~ exit-code = 1 2 | 3 | [] 4 | -------------------------------------------------------------------------------- /tests/fail/elaboration/ambiguous-array-literal.snap: -------------------------------------------------------------------------------- 1 | stdout = '' 2 | stderr = ''' 3 | error: ambiguous array literal 4 | ┌─ tests/fail/elaboration/ambiguous-array-literal.fathom:3:1 5 | │ 6 | 3 │ [] 7 | │ ^^ type annotations needed 8 | 9 | ''' 10 | -------------------------------------------------------------------------------- /tests/fail/elaboration/array-literal-not-supported.fathom: -------------------------------------------------------------------------------- 1 | //~ exit-code = 1 2 | 3 | [] : Void 4 | -------------------------------------------------------------------------------- /tests/fail/elaboration/array-literal-not-supported.snap: -------------------------------------------------------------------------------- 1 | stdout = '' 2 | stderr = ''' 3 | error: array literal not supported 4 | ┌─ tests/fail/elaboration/array-literal-not-supported.fathom:3:1 5 | │ 6 | 3 │ [] : Void 7 | │ ^^ expected `Void` 8 | │ 9 | = expected `Void` 10 | 11 | ''' 12 | -------------------------------------------------------------------------------- /tests/fail/elaboration/block-comment.fathom: -------------------------------------------------------------------------------- 1 | let x = /* true */ false; 2 | {} 3 | -------------------------------------------------------------------------------- /tests/fail/elaboration/block-comment.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | let x : Bool = false; () : () 3 | ''' 4 | stderr = '' 5 | -------------------------------------------------------------------------------- /tests/fail/elaboration/boolean-literal/not-supported.fathom: -------------------------------------------------------------------------------- 1 | //~ exit-code = 1 2 | 3 | let x: U16 = 123; 4 | 5 | match x { 6 | false => 0, 7 | true => 1, 8 | } : U32 9 | -------------------------------------------------------------------------------- /tests/fail/elaboration/boolean-literal/not-supported.snap: -------------------------------------------------------------------------------- 1 | stdout = '' 2 | stderr = ''' 3 | error: boolean literal not supported for expected type 4 | ┌─ tests/fail/elaboration/boolean-literal/not-supported.fathom:6:5 5 | │ 6 | 6 │ false => 0, 7 | │ ^^^^^ 8 | 9 | error: boolean literal not supported for expected type 10 | ┌─ tests/fail/elaboration/boolean-literal/not-supported.fathom:7:5 11 | │ 12 | 7 │ true => 1, 13 | │ ^^^^ 14 | 15 | ''' 16 | -------------------------------------------------------------------------------- /tests/fail/elaboration/boolean-literal/type-mismatch.fathom: -------------------------------------------------------------------------------- 1 | //~ exit-code = 1 2 | 3 | true : Void 4 | -------------------------------------------------------------------------------- /tests/fail/elaboration/boolean-literal/type-mismatch.snap: -------------------------------------------------------------------------------- 1 | stdout = '' 2 | stderr = ''' 3 | error: mismatched types 4 | ┌─ tests/fail/elaboration/boolean-literal/type-mismatch.fathom:3:1 5 | │ 6 | 3 │ true : Void 7 | │ ^^^^ type mismatch, expected `Void`, found `Bool` 8 | │ 9 | = expected `Void` 10 | found `Bool` 11 | 12 | ''' 13 | -------------------------------------------------------------------------------- /tests/fail/elaboration/duplicate-field-labels/record-literal.fathom: -------------------------------------------------------------------------------- 1 | //~ exit-code = 1 2 | 3 | { x = Type, y = Type, x = Type } 4 | -------------------------------------------------------------------------------- /tests/fail/elaboration/duplicate-field-labels/record-literal.snap: -------------------------------------------------------------------------------- 1 | stdout = '' 2 | stderr = ''' 3 | error: duplicate labels found in record 4 | ┌─ tests/fail/elaboration/duplicate-field-labels/record-literal.fathom:3:23 5 | │ 6 | 3 │ { x = Type, y = Type, x = Type } 7 | │ ----------------------^--------- 8 | │ │ │ 9 | │ │ duplicate field 10 | │ the record literal 11 | │ 12 | = duplicate fields `x` 13 | 14 | ''' 15 | -------------------------------------------------------------------------------- /tests/fail/elaboration/duplicate-field-labels/record-type.fathom: -------------------------------------------------------------------------------- 1 | //~ exit-code = 1 2 | 3 | { x : Type, y : Type, x : Type } 4 | -------------------------------------------------------------------------------- /tests/fail/elaboration/duplicate-field-labels/record-type.snap: -------------------------------------------------------------------------------- 1 | stdout = '' 2 | stderr = ''' 3 | error: duplicate labels found in record 4 | ┌─ tests/fail/elaboration/duplicate-field-labels/record-type.fathom:3:23 5 | │ 6 | 3 │ { x : Type, y : Type, x : Type } 7 | │ ----------------------^--------- 8 | │ │ │ 9 | │ │ duplicate field 10 | │ the record literal 11 | │ 12 | = duplicate fields `x` 13 | 14 | ''' 15 | -------------------------------------------------------------------------------- /tests/fail/elaboration/implicit-args/app-plicity-mismatch.fathom: -------------------------------------------------------------------------------- 1 | //~ exit-code = 1 2 | 3 | let id1 = fun (A : Type) (a : A) => a; 4 | let id2 = fun (@A : Type) (a : A) => a; 5 | 6 | let _ : Bool = id1 @Bool true; 7 | let _ : Bool = id2 @Bool @true; 8 | {} 9 | -------------------------------------------------------------------------------- /tests/fail/elaboration/implicit-args/unexpected-argument.fathom: -------------------------------------------------------------------------------- 1 | //~ exit-code = 1 2 | 3 | true @Bool 4 | -------------------------------------------------------------------------------- /tests/fail/elaboration/implicit-args/unexpected-argument.snap: -------------------------------------------------------------------------------- 1 | stdout = '' 2 | stderr = ''' 3 | error: expression was applied to an unexpected argument 4 | ┌─ tests/fail/elaboration/implicit-args/unexpected-argument.fathom:3:7 5 | │ 6 | 3 │ true @Bool 7 | │ ---- ^^^^ unexpected argument 8 | │ │ 9 | │ expression of type Bool 10 | 11 | ''' 12 | -------------------------------------------------------------------------------- /tests/fail/elaboration/item-cycle.fathom: -------------------------------------------------------------------------------- 1 | //~ exit-code = 1 2 | //~ mode = "module" 3 | 4 | def first = second; 5 | def second = third; 6 | def third = first; 7 | 8 | def ok = u16be; 9 | def ok2 = { 10 | x <- ok, 11 | }; 12 | 13 | def a = b; 14 | def b = c; 15 | def c = d; 16 | def d = b; 17 | -------------------------------------------------------------------------------- /tests/fail/elaboration/item-cycle.snap: -------------------------------------------------------------------------------- 1 | stdout = '' 2 | stderr = ''' 3 | error: cycle detected 4 | = first → second → third → first 5 | 6 | error: cycle detected 7 | = a → b → c → d → b 8 | 9 | ''' 10 | -------------------------------------------------------------------------------- /tests/fail/elaboration/mismatched-array-length/array16.fathom: -------------------------------------------------------------------------------- 1 | //~ exit-code = 1 2 | 3 | [34] : Array16 0 U32 4 | -------------------------------------------------------------------------------- /tests/fail/elaboration/mismatched-array-length/array16.snap: -------------------------------------------------------------------------------- 1 | stdout = '' 2 | stderr = ''' 3 | error: mismatched array length 4 | ┌─ tests/fail/elaboration/mismatched-array-length/array16.fathom:3:1 5 | │ 6 | 3 │ [34] : Array16 0 U32 7 | │ ^^^^ array with invalid length 8 | │ 9 | = expected length 0 10 | = found length 1 11 | 12 | ''' 13 | -------------------------------------------------------------------------------- /tests/fail/elaboration/mismatched-array-length/array32.fathom: -------------------------------------------------------------------------------- 1 | //~ exit-code = 1 2 | 3 | [1] : Array32 3 U32 4 | -------------------------------------------------------------------------------- /tests/fail/elaboration/mismatched-array-length/array32.snap: -------------------------------------------------------------------------------- 1 | stdout = '' 2 | stderr = ''' 3 | error: mismatched array length 4 | ┌─ tests/fail/elaboration/mismatched-array-length/array32.fathom:3:1 5 | │ 6 | 3 │ [1] : Array32 3 U32 7 | │ ^^^ array with invalid length 8 | │ 9 | = expected length 3 10 | = found length 1 11 | 12 | ''' 13 | -------------------------------------------------------------------------------- /tests/fail/elaboration/mismatched-array-length/array64.fathom: -------------------------------------------------------------------------------- 1 | //~ exit-code = 1 2 | 3 | [1, 2, 3, 42] : Array64 3 U32 4 | -------------------------------------------------------------------------------- /tests/fail/elaboration/mismatched-array-length/array64.snap: -------------------------------------------------------------------------------- 1 | stdout = '' 2 | stderr = ''' 3 | error: mismatched array length 4 | ┌─ tests/fail/elaboration/mismatched-array-length/array64.fathom:3:1 5 | │ 6 | 3 │ [1, 2, 3, 42] : Array64 3 U32 7 | │ ^^^^^^^^^^^^^ array with invalid length 8 | │ 9 | = expected length 3 10 | = found length 4 11 | 12 | ''' 13 | -------------------------------------------------------------------------------- /tests/fail/elaboration/mismatched-array-length/array8.fathom: -------------------------------------------------------------------------------- 1 | //~ exit-code = 1 2 | 3 | [] : Array8 2 U32 4 | -------------------------------------------------------------------------------- /tests/fail/elaboration/mismatched-array-length/array8.snap: -------------------------------------------------------------------------------- 1 | stdout = '' 2 | stderr = ''' 3 | error: mismatched array length 4 | ┌─ tests/fail/elaboration/mismatched-array-length/array8.fathom:3:1 5 | │ 6 | 3 │ [] : Array8 2 U32 7 | │ ^^ array with invalid length 8 | │ 9 | = expected length 2 10 | = found length 0 11 | 12 | ''' 13 | -------------------------------------------------------------------------------- /tests/fail/elaboration/mismatched-field-labels/expected-field.fathom: -------------------------------------------------------------------------------- 1 | //~ exit-code = 1 2 | 3 | { x = {}, y = {} } : { y : Type, x : Type } 4 | -------------------------------------------------------------------------------- /tests/fail/elaboration/mismatched-field-labels/expected-field.snap: -------------------------------------------------------------------------------- 1 | stdout = '' 2 | stderr = ''' 3 | error: mismatched field labels in record literal 4 | ┌─ tests/fail/elaboration/mismatched-field-labels/expected-field.fathom:3:3 5 | │ 6 | 3 │ { x = {}, y = {} } : { y : Type, x : Type } 7 | │ --^-------^------- 8 | │ │ │ │ 9 | │ │ │ unexpected field `y` 10 | │ │ expected field `y` 11 | │ the record literal 12 | │ 13 | = expected fields `y`, `x` 14 | = found fields `x`, `y` 15 | 16 | ''' 17 | -------------------------------------------------------------------------------- /tests/fail/elaboration/mismatched-field-labels/missing-field.fathom: -------------------------------------------------------------------------------- 1 | //~ exit-code = 1 2 | 3 | { x = {} } : { x : Type, y : Type } 4 | -------------------------------------------------------------------------------- /tests/fail/elaboration/mismatched-field-labels/missing-field.snap: -------------------------------------------------------------------------------- 1 | stdout = '' 2 | stderr = ''' 3 | error: mismatched field labels in record literal 4 | ┌─ tests/fail/elaboration/mismatched-field-labels/missing-field.fathom:3:1 5 | │ 6 | 3 │ { x = {} } : { x : Type, y : Type } 7 | │ ^^^^^^^^^^ missing fields `y` 8 | │ 9 | = expected fields `x`, `y` 10 | = found fields `x` 11 | 12 | ''' 13 | -------------------------------------------------------------------------------- /tests/fail/elaboration/mismatched-field-labels/tuple.fathom: -------------------------------------------------------------------------------- 1 | //~ exit-code = 1 2 | 3 | let Triple: Type = (U16, U16, U16); 4 | let Point: Type = {x: U16, y: U16, z: U16}; 5 | let Any: Type = {A: Type, a: A}; 6 | 7 | let too_short_triple: Triple = (0, 1); 8 | let too_long_triple: Triple = (0, 1, 2, 3); 9 | 10 | let too_short_point: Point = (0, 1); 11 | let too_long_point: Point = (0, 1, 2, 3); 12 | 13 | let too_short_any: Any = (); 14 | let too_long_any: Any = (Bool, false, true); 15 | 16 | () 17 | -------------------------------------------------------------------------------- /tests/fail/elaboration/mismatched-field-labels/unexpected-field.fathom: -------------------------------------------------------------------------------- 1 | //~ exit-code = 1 2 | 3 | { x = {}, y = {} } : { x : Type } 4 | -------------------------------------------------------------------------------- /tests/fail/elaboration/mismatched-field-labels/unexpected-field.snap: -------------------------------------------------------------------------------- 1 | stdout = '' 2 | stderr = ''' 3 | error: mismatched field labels in record literal 4 | ┌─ tests/fail/elaboration/mismatched-field-labels/unexpected-field.fathom:3:11 5 | │ 6 | 3 │ { x = {}, y = {} } : { x : Type } 7 | │ ----------^------- 8 | │ │ │ 9 | │ │ unexpected field `y` 10 | │ the record literal 11 | │ 12 | = expected fields `x` 13 | = found fields `x`, `y` 14 | 15 | ''' 16 | -------------------------------------------------------------------------------- /tests/fail/elaboration/non-exhaustive-patterns/match-check.fathom: -------------------------------------------------------------------------------- 1 | //~ exit-code = 1 2 | 3 | match (x : U8) {} : U32 4 | -------------------------------------------------------------------------------- /tests/fail/elaboration/non-exhaustive-patterns/match-check.snap: -------------------------------------------------------------------------------- 1 | stdout = '' 2 | stderr = ''' 3 | error: cannot find `x` in scope 4 | ┌─ tests/fail/elaboration/non-exhaustive-patterns/match-check.fathom:3:8 5 | │ 6 | 3 │ match (x : U8) {} : U32 7 | │ ^ unbound name 8 | 9 | error: non-exhaustive patterns in match expression 10 | ┌─ tests/fail/elaboration/non-exhaustive-patterns/match-check.fathom:3:7 11 | │ 12 | 3 │ match (x : U8) {} : U32 13 | │ ------^^^^^^^^--- 14 | │ │ │ 15 | │ │ patterns not covered 16 | │ in match expression 17 | 18 | ''' 19 | -------------------------------------------------------------------------------- /tests/fail/elaboration/non-exhaustive-patterns/match-duplicate.fathom: -------------------------------------------------------------------------------- 1 | //~ exit-code = 1 2 | 3 | match true { 4 | true => 1, 5 | true => 2 6 | } : U32 7 | -------------------------------------------------------------------------------- /tests/fail/elaboration/non-exhaustive-patterns/match-duplicate.snap: -------------------------------------------------------------------------------- 1 | stdout = '' 2 | stderr = ''' 3 | warning: unreachable pattern 4 | ┌─ tests/fail/elaboration/non-exhaustive-patterns/match-duplicate.fathom:5:3 5 | │ 6 | 5 │ true => 2 7 | │ ^^^^ 8 | 9 | error: non-exhaustive patterns in match expression 10 | ┌─ tests/fail/elaboration/non-exhaustive-patterns/match-duplicate.fathom:3:7 11 | │ 12 | 3 │ ╭ match true { 13 | │ ^^^^ patterns not covered 14 | 4 │ │ true => 1, 15 | 5 │ │ true => 2 16 | 6 │ │ } : U32 17 | │ ╰─' in match expression 18 | 19 | ''' 20 | -------------------------------------------------------------------------------- /tests/fail/elaboration/non-exhaustive-patterns/match-synth.fathom: -------------------------------------------------------------------------------- 1 | //~ exit-code = 1 2 | 3 | match (x : U8) {} 4 | -------------------------------------------------------------------------------- /tests/fail/elaboration/numeric-literal/ambiguous.fathom: -------------------------------------------------------------------------------- 1 | //~ exit-code = 1 2 | 3 | 34 4 | -------------------------------------------------------------------------------- /tests/fail/elaboration/numeric-literal/ambiguous.snap: -------------------------------------------------------------------------------- 1 | stdout = '' 2 | stderr = ''' 3 | error: ambiguous numeric literal 4 | ┌─ tests/fail/elaboration/numeric-literal/ambiguous.fathom:3:1 5 | │ 6 | 3 │ 34 7 | │ ^^ type annotations needed 8 | 9 | ''' 10 | -------------------------------------------------------------------------------- /tests/fail/elaboration/numeric-literal/invalid.fathom: -------------------------------------------------------------------------------- 1 | //~ exit-code = 1 2 | 3 | 0zzz : U32 4 | -------------------------------------------------------------------------------- /tests/fail/elaboration/numeric-literal/invalid.snap: -------------------------------------------------------------------------------- 1 | stdout = '' 2 | stderr = ''' 3 | error: failed to parse numeric literal 4 | ┌─ tests/fail/elaboration/numeric-literal/invalid.fathom:3:1 5 | │ 6 | 3 │ 0zzz : U32 7 | │ ^^^^ invalid digit found in string 8 | 9 | ''' 10 | -------------------------------------------------------------------------------- /tests/fail/elaboration/numeric-literal/mismatched-length.fathom: -------------------------------------------------------------------------------- 1 | //~ exit-code = 1 2 | 3 | [3, 4] : Array8 12 U32 4 | -------------------------------------------------------------------------------- /tests/fail/elaboration/numeric-literal/mismatched-length.snap: -------------------------------------------------------------------------------- 1 | stdout = '' 2 | stderr = ''' 3 | error: mismatched array length 4 | ┌─ tests/fail/elaboration/numeric-literal/mismatched-length.fathom:3:1 5 | │ 6 | 3 │ [3, 4] : Array8 12 U32 7 | │ ^^^^^^ array with invalid length 8 | │ 9 | = expected length 12 10 | = found length 2 11 | 12 | ''' 13 | -------------------------------------------------------------------------------- /tests/fail/elaboration/numeric-literal/not-supported.fathom: -------------------------------------------------------------------------------- 1 | //~ exit-code = 1 2 | 3 | 3 : Void 4 | -------------------------------------------------------------------------------- /tests/fail/elaboration/numeric-literal/not-supported.snap: -------------------------------------------------------------------------------- 1 | stdout = '' 2 | stderr = ''' 3 | error: numeric literal not supported 4 | ┌─ tests/fail/elaboration/numeric-literal/not-supported.fathom:3:1 5 | │ 6 | 3 │ 3 : Void 7 | │ ^ expected `Void` 8 | │ 9 | = expected `Void` 10 | 11 | ''' 12 | -------------------------------------------------------------------------------- /tests/fail/elaboration/string-literal/ambiguous.fathom: -------------------------------------------------------------------------------- 1 | //~ exit-code = 1 2 | 3 | "hello" 4 | -------------------------------------------------------------------------------- /tests/fail/elaboration/string-literal/ambiguous.snap: -------------------------------------------------------------------------------- 1 | stdout = '' 2 | stderr = ''' 3 | error: ambiguous string literal 4 | ┌─ tests/fail/elaboration/string-literal/ambiguous.fathom:3:1 5 | │ 6 | 3 │ "hello" 7 | │ ^^^^^^^ type annotations needed 8 | 9 | ''' 10 | -------------------------------------------------------------------------------- /tests/fail/elaboration/string-literal/non-ascii.fathom: -------------------------------------------------------------------------------- 1 | //~ exit-code = 1 2 | 3 | " ×" : U16 4 | -------------------------------------------------------------------------------- /tests/fail/elaboration/string-literal/non-ascii.snap: -------------------------------------------------------------------------------- 1 | stdout = '' 2 | stderr = ''' 3 | error: non-ASCII character found in string literal 4 | ┌─ tests/fail/elaboration/string-literal/non-ascii.fathom:3:3 5 | │ 6 | 3 │ " ×" : U16 7 | │ ^ non-ASCII character 8 | 9 | ''' 10 | -------------------------------------------------------------------------------- /tests/fail/elaboration/string-literal/not-supported.fathom: -------------------------------------------------------------------------------- 1 | //~ exit-code = 1 2 | 3 | "hello" : Void 4 | -------------------------------------------------------------------------------- /tests/fail/elaboration/string-literal/not-supported.snap: -------------------------------------------------------------------------------- 1 | stdout = '' 2 | stderr = ''' 3 | error: string literal not supported 4 | ┌─ tests/fail/elaboration/string-literal/not-supported.fathom:3:1 5 | │ 6 | 3 │ "hello" : Void 7 | │ ^^^^^^^ expected `Void` 8 | │ 9 | = expected `Void` 10 | 11 | ''' 12 | -------------------------------------------------------------------------------- /tests/fail/elaboration/string-literal/overflowing.fathom: -------------------------------------------------------------------------------- 1 | //~ exit-code = 1 2 | 3 | "hello" : U8 4 | -------------------------------------------------------------------------------- /tests/fail/elaboration/string-literal/overflowing.snap: -------------------------------------------------------------------------------- 1 | stdout = '' 2 | stderr = ''' 3 | error: mismatched number of bytes in string literal 4 | ┌─ tests/fail/elaboration/string-literal/overflowing.fathom:3:1 5 | │ 6 | 3 │ "hello" : U8 7 | │ ^^^^^^^ invalid string literal 8 | │ 9 | = expected byte length 1 10 | = found byte length 5 11 | 12 | ''' 13 | -------------------------------------------------------------------------------- /tests/fail/elaboration/string-literal/underflowing.fathom: -------------------------------------------------------------------------------- 1 | //~ exit-code = 1 2 | 3 | "oops" : U64 4 | -------------------------------------------------------------------------------- /tests/fail/elaboration/string-literal/underflowing.snap: -------------------------------------------------------------------------------- 1 | stdout = '' 2 | stderr = ''' 3 | error: mismatched number of bytes in string literal 4 | ┌─ tests/fail/elaboration/string-literal/underflowing.fathom:3:1 5 | │ 6 | 3 │ "oops" : U64 7 | │ ^^^^^^ invalid string literal 8 | │ 9 | = expected byte length 8 10 | = found byte length 4 11 | 12 | ''' 13 | -------------------------------------------------------------------------------- /tests/fail/elaboration/unbound-name.fathom: -------------------------------------------------------------------------------- 1 | //~ exit-code = 1 2 | 3 | woopsie 4 | -------------------------------------------------------------------------------- /tests/fail/elaboration/unbound-name.snap: -------------------------------------------------------------------------------- 1 | stdout = '' 2 | stderr = ''' 3 | error: cannot find `woopsie` in scope 4 | ┌─ tests/fail/elaboration/unbound-name.fathom:3:1 5 | │ 6 | 3 │ woopsie 7 | │ ^^^^^^^ unbound name 8 | 9 | ''' 10 | -------------------------------------------------------------------------------- /tests/fail/elaboration/unexpected-argument/record-type.fathom: -------------------------------------------------------------------------------- 1 | //~ exit-code = 1 2 | 3 | { x : Type } x y 4 | -------------------------------------------------------------------------------- /tests/fail/elaboration/unexpected-argument/record-type.snap: -------------------------------------------------------------------------------- 1 | stdout = '' 2 | stderr = ''' 3 | error: expression was applied to an unexpected argument 4 | ┌─ tests/fail/elaboration/unexpected-argument/record-type.fathom:3:14 5 | │ 6 | 3 │ { x : Type } x y 7 | │ ------------ ^ unexpected argument 8 | │ │ 9 | │ expression of type Type 10 | 11 | ''' 12 | -------------------------------------------------------------------------------- /tests/fail/elaboration/unexpected-argument/unbound-head-1.fathom: -------------------------------------------------------------------------------- 1 | //~ exit-code = 1 2 | 3 | f x 4 | -------------------------------------------------------------------------------- /tests/fail/elaboration/unexpected-argument/unbound-head-1.snap: -------------------------------------------------------------------------------- 1 | stdout = '' 2 | stderr = ''' 3 | error: cannot find `f` in scope 4 | ┌─ tests/fail/elaboration/unexpected-argument/unbound-head-1.fathom:3:1 5 | │ 6 | 3 │ f x 7 | │ ^ unbound name 8 | 9 | ''' 10 | -------------------------------------------------------------------------------- /tests/fail/elaboration/unexpected-argument/unbound-head-2.fathom: -------------------------------------------------------------------------------- 1 | //~ exit-code = 1 2 | 3 | f x y 4 | -------------------------------------------------------------------------------- /tests/fail/elaboration/unexpected-argument/unbound-head-2.snap: -------------------------------------------------------------------------------- 1 | stdout = '' 2 | stderr = ''' 3 | error: cannot find `f` in scope 4 | ┌─ tests/fail/elaboration/unexpected-argument/unbound-head-2.fathom:3:1 5 | │ 6 | 3 │ f x y 7 | │ ^ unbound name 8 | 9 | ''' 10 | -------------------------------------------------------------------------------- /tests/fail/elaboration/unexpected-parameter/fun-literal.fathom: -------------------------------------------------------------------------------- 1 | //~ exit-code = 1 2 | 3 | fun A a b => a : fun (A : Type) -> A -> A 4 | -------------------------------------------------------------------------------- /tests/fail/elaboration/unexpected-parameter/fun-literal.snap: -------------------------------------------------------------------------------- 1 | stdout = '' 2 | stderr = ''' 3 | error: too many parameters in function literal 4 | ┌─ tests/fail/elaboration/unexpected-parameter/fun-literal.fathom:3:9 5 | │ 6 | 3 │ fun A a b => a : fun (A : Type) -> A -> A 7 | │ ^ unexpected parameter 8 | │ 9 | = this parameter can be removed 10 | 11 | ''' 12 | -------------------------------------------------------------------------------- /tests/fail/elaboration/unification/escaping-local-var.fathom: -------------------------------------------------------------------------------- 1 | //~ exit-code = 1 2 | 3 | fun n => n : _ -> _ 4 | -------------------------------------------------------------------------------- /tests/fail/elaboration/unification/escaping-local-var.snap: -------------------------------------------------------------------------------- 1 | stdout = '' 2 | stderr = ''' 3 | error: escaping local variable 4 | ┌─ tests/fail/elaboration/unification/escaping-local-var.fathom:3:10 5 | │ 6 | 3 │ fun n => n : _ -> _ 7 | │ ^ 8 | 9 | error: failed to infer placeholder expression 10 | ┌─ tests/fail/elaboration/unification/escaping-local-var.fathom:3:14 11 | │ 12 | 3 │ fun n => n : _ -> _ 13 | │ ^ unsolved placeholder expression 14 | 15 | error: failed to infer placeholder expression 16 | ┌─ tests/fail/elaboration/unification/escaping-local-var.fathom:3:19 17 | │ 18 | 3 │ fun n => n : _ -> _ 19 | │ ^ unsolved placeholder expression 20 | 21 | ''' 22 | -------------------------------------------------------------------------------- /tests/fail/elaboration/unification/infinite-solution.fathom: -------------------------------------------------------------------------------- 1 | //~ exit-code = 1 2 | 3 | let test : 4 | fun (Wrap : Type -> Type) -> 5 | fun (f : fun (A : _) -> (A -> Wrap A) -> Type) -> 6 | Type 7 | = fun Wrap => fun f => 8 | f _ (fun a => a); 9 | 10 | Type 11 | -------------------------------------------------------------------------------- /tests/fail/elaboration/unification/infinite-solution.snap: -------------------------------------------------------------------------------- 1 | stdout = '' 2 | stderr = ''' 3 | error: infinite solution 4 | ┌─ tests/fail/elaboration/unification/infinite-solution.fathom:8:21 5 | │ 6 | 8 │ f _ (fun a => a); 7 | │ ^ 8 | 9 | error: failed to infer placeholder expression 10 | ┌─ tests/fail/elaboration/unification/infinite-solution.fathom:8:9 11 | │ 12 | 8 │ f _ (fun a => a); 13 | │ ^ unsolved placeholder expression 14 | 15 | ''' 16 | -------------------------------------------------------------------------------- /tests/fail/elaboration/unification/mismatch/arrow-body-type.fathom: -------------------------------------------------------------------------------- 1 | //~ exit-code = 1 2 | 3 | fun (A : Type) -> fun (a : A) -> A -> a 4 | -------------------------------------------------------------------------------- /tests/fail/elaboration/unification/mismatch/arrow-body-type.snap: -------------------------------------------------------------------------------- 1 | stdout = '' 2 | stderr = ''' 3 | error: mismatched types 4 | ┌─ tests/fail/elaboration/unification/mismatch/arrow-body-type.fathom:3:39 5 | │ 6 | 3 │ fun (A : Type) -> fun (a : A) -> A -> a 7 | │ ^ type mismatch, expected `Type`, found `A` 8 | │ 9 | = expected `Type` 10 | found `A` 11 | 12 | ''' 13 | -------------------------------------------------------------------------------- /tests/fail/elaboration/unification/mismatch/arrow-both.fathom: -------------------------------------------------------------------------------- 1 | //~ exit-code = 1 2 | 3 | fun (A : Type) -> fun (a : A) -> a -> a 4 | -------------------------------------------------------------------------------- /tests/fail/elaboration/unification/mismatch/arrow-both.snap: -------------------------------------------------------------------------------- 1 | stdout = '' 2 | stderr = ''' 3 | error: mismatched types 4 | ┌─ tests/fail/elaboration/unification/mismatch/arrow-both.fathom:3:34 5 | │ 6 | 3 │ fun (A : Type) -> fun (a : A) -> a -> a 7 | │ ^ type mismatch, expected `Type`, found `A` 8 | │ 9 | = expected `Type` 10 | found `A` 11 | 12 | error: mismatched types 13 | ┌─ tests/fail/elaboration/unification/mismatch/arrow-both.fathom:3:39 14 | │ 15 | 3 │ fun (A : Type) -> fun (a : A) -> a -> a 16 | │ ^ type mismatch, expected `Type`, found `A` 17 | │ 18 | = expected `Type` 19 | found `A` 20 | 21 | ''' 22 | -------------------------------------------------------------------------------- /tests/fail/elaboration/unification/mismatch/arrow-param-type.fathom: -------------------------------------------------------------------------------- 1 | //~ exit-code = 1 2 | 3 | fun (A : Type) -> fun (a : A) -> a -> A 4 | -------------------------------------------------------------------------------- /tests/fail/elaboration/unification/mismatch/arrow-param-type.snap: -------------------------------------------------------------------------------- 1 | stdout = '' 2 | stderr = ''' 3 | error: mismatched types 4 | ┌─ tests/fail/elaboration/unification/mismatch/arrow-param-type.fathom:3:34 5 | │ 6 | 3 │ fun (A : Type) -> fun (a : A) -> a -> A 7 | │ ^ type mismatch, expected `Type`, found `A` 8 | │ 9 | = expected `Type` 10 | found `A` 11 | 12 | ''' 13 | -------------------------------------------------------------------------------- /tests/fail/elaboration/unification/mismatch/fun-literal-body-expr.fathom: -------------------------------------------------------------------------------- 1 | //~ exit-code = 1 2 | 3 | fun A => fun a => A : fun (A : Type) -> A -> A 4 | -------------------------------------------------------------------------------- /tests/fail/elaboration/unification/mismatch/fun-literal-body-expr.snap: -------------------------------------------------------------------------------- 1 | stdout = '' 2 | stderr = ''' 3 | error: mismatched types 4 | ┌─ tests/fail/elaboration/unification/mismatch/fun-literal-body-expr.fathom:3:19 5 | │ 6 | 3 │ fun A => fun a => A : fun (A : Type) -> A -> A 7 | │ ^ type mismatch, expected `A`, found `Type` 8 | │ 9 | = expected `A` 10 | found `Type` 11 | 12 | ''' 13 | -------------------------------------------------------------------------------- /tests/fail/elaboration/unification/mismatch/fun-literal-param-ann.fathom: -------------------------------------------------------------------------------- 1 | //~ exit-code = 1 2 | 3 | fun A => fun (a : Type) => a : fun (A : Type) -> A -> A 4 | -------------------------------------------------------------------------------- /tests/fail/elaboration/unification/mismatch/fun-literal-param-ann.snap: -------------------------------------------------------------------------------- 1 | stdout = '' 2 | stderr = ''' 3 | error: mismatched types 4 | ┌─ tests/fail/elaboration/unification/mismatch/fun-literal-param-ann.fathom:3:19 5 | │ 6 | 3 │ fun A => fun (a : Type) => a : fun (A : Type) -> A -> A 7 | │ ^^^^ type mismatch, expected `A`, found `Type` 8 | │ 9 | = expected `A` 10 | found `Type` 11 | 12 | error: cannot find `a` in scope 13 | ┌─ tests/fail/elaboration/unification/mismatch/fun-literal-param-ann.fathom:3:28 14 | │ 15 | 3 │ fun A => fun (a : Type) => a : fun (A : Type) -> A -> A 16 | │ ^ unbound name 17 | │ 18 | = help: did you mean `A`? 19 | 20 | ''' 21 | -------------------------------------------------------------------------------- /tests/fail/elaboration/unification/mismatch/fun-type-body-type.fathom: -------------------------------------------------------------------------------- 1 | //~ exit-code = 1 2 | 3 | fun (A : Type) -> fun (a : A) -> a 4 | -------------------------------------------------------------------------------- /tests/fail/elaboration/unification/mismatch/fun-type-body-type.snap: -------------------------------------------------------------------------------- 1 | stdout = '' 2 | stderr = ''' 3 | error: mismatched types 4 | ┌─ tests/fail/elaboration/unification/mismatch/fun-type-body-type.fathom:3:34 5 | │ 6 | 3 │ fun (A : Type) -> fun (a : A) -> a 7 | │ ^ type mismatch, expected `Type`, found `A` 8 | │ 9 | = expected `Type` 10 | found `A` 11 | 12 | ''' 13 | -------------------------------------------------------------------------------- /tests/fail/elaboration/unification/mismatch/fun-type-both.fathom: -------------------------------------------------------------------------------- 1 | //~ exit-code = 1 2 | 3 | fun (A : Type) -> fun (a : A) -> fun (b : a) -> a 4 | -------------------------------------------------------------------------------- /tests/fail/elaboration/unification/mismatch/fun-type-both.snap: -------------------------------------------------------------------------------- 1 | stdout = '' 2 | stderr = ''' 3 | error: mismatched types 4 | ┌─ tests/fail/elaboration/unification/mismatch/fun-type-both.fathom:3:43 5 | │ 6 | 3 │ fun (A : Type) -> fun (a : A) -> fun (b : a) -> a 7 | │ ^ type mismatch, expected `Type`, found `A` 8 | │ 9 | = expected `Type` 10 | found `A` 11 | 12 | error: mismatched types 13 | ┌─ tests/fail/elaboration/unification/mismatch/fun-type-both.fathom:3:49 14 | │ 15 | 3 │ fun (A : Type) -> fun (a : A) -> fun (b : a) -> a 16 | │ ^ type mismatch, expected `Type`, found `A` 17 | │ 18 | = expected `Type` 19 | found `A` 20 | 21 | ''' 22 | -------------------------------------------------------------------------------- /tests/fail/elaboration/unification/mismatch/fun-type-param-type.fathom: -------------------------------------------------------------------------------- 1 | //~ exit-code = 1 2 | 3 | fun (A : Type) -> fun (a : A) -> fun (b : a) -> A 4 | -------------------------------------------------------------------------------- /tests/fail/elaboration/unification/mismatch/fun-type-param-type.snap: -------------------------------------------------------------------------------- 1 | stdout = '' 2 | stderr = ''' 3 | error: mismatched types 4 | ┌─ tests/fail/elaboration/unification/mismatch/fun-type-param-type.fathom:3:43 5 | │ 6 | 3 │ fun (A : Type) -> fun (a : A) -> fun (b : a) -> A 7 | │ ^ type mismatch, expected `Type`, found `A` 8 | │ 9 | = expected `Type` 10 | found `A` 11 | 12 | ''' 13 | -------------------------------------------------------------------------------- /tests/fail/elaboration/unification/mismatch/match-equation-body-exprs.fathom: -------------------------------------------------------------------------------- 1 | //~ exit-code = 1 2 | 3 | match (x : U8) { 4 | _ => 3 : U32, 5 | _ => 4 : U64, 6 | _ => Type, 7 | } 8 | -------------------------------------------------------------------------------- /tests/fail/elaboration/unification/mismatch/record-literal-singleton.fathom: -------------------------------------------------------------------------------- 1 | //~ exit-code = 1 2 | 3 | let Unit : Type = {}; 4 | let unit : Unit = {}; 5 | 6 | { thing = unit } : { thing : Type } 7 | -------------------------------------------------------------------------------- /tests/fail/elaboration/unification/mismatch/record-literal-singleton.snap: -------------------------------------------------------------------------------- 1 | stdout = '' 2 | stderr = ''' 3 | error: mismatched types 4 | ┌─ tests/fail/elaboration/unification/mismatch/record-literal-singleton.fathom:6:11 5 | │ 6 | 6 │ { thing = unit } : { thing : Type } 7 | │ ^^^^ type mismatch, expected `Type`, found `()` 8 | │ 9 | = expected `Type` 10 | found `()` 11 | 12 | ''' 13 | -------------------------------------------------------------------------------- /tests/fail/elaboration/unification/mismatch/record-type-singleton.fathom: -------------------------------------------------------------------------------- 1 | //~ exit-code = 1 2 | 3 | let Unit : Type = {}; 4 | let unit : Unit = {}; 5 | 6 | { thing : unit } 7 | -------------------------------------------------------------------------------- /tests/fail/elaboration/unification/mismatch/record-type-singleton.snap: -------------------------------------------------------------------------------- 1 | stdout = '' 2 | stderr = ''' 3 | error: mismatched types 4 | ┌─ tests/fail/elaboration/unification/mismatch/record-type-singleton.fathom:6:11 5 | │ 6 | 6 │ { thing : unit } 7 | │ ^^^^ type mismatch, expected `Type`, found `()` 8 | │ 9 | = expected `Type` 10 | found `()` 11 | 12 | ''' 13 | -------------------------------------------------------------------------------- /tests/fail/elaboration/unification/non-linear-spine.fathom: -------------------------------------------------------------------------------- 1 | //~ exit-code = 1 2 | 3 | let test : fun (A : _) -> (A -> _) -> A 4 | = fun A => fun a => (a _); 5 | 6 | Type 7 | -------------------------------------------------------------------------------- /tests/fail/elaboration/unknown-field/record-literal.fathom: -------------------------------------------------------------------------------- 1 | //~ exit-code = 1 2 | 3 | { hello = {} }.goodbye 4 | -------------------------------------------------------------------------------- /tests/fail/elaboration/unknown-field/record-literal.snap: -------------------------------------------------------------------------------- 1 | stdout = '' 2 | stderr = ''' 3 | error: cannot find `goodbye` in expression 4 | ┌─ tests/fail/elaboration/unknown-field/record-literal.fathom:3:16 5 | │ 6 | 3 │ { hello = {} }.goodbye 7 | │ -------------- ^^^^^^^ unknown label 8 | │ │ 9 | │ expression of type { hello : () } 10 | │ 11 | = help: did you mean `goodbye`? 12 | 13 | ''' 14 | -------------------------------------------------------------------------------- /tests/fail/elaboration/unknown-field/type.fathom: -------------------------------------------------------------------------------- 1 | //~ exit-code = 1 2 | 3 | Type.foo 4 | -------------------------------------------------------------------------------- /tests/fail/elaboration/unknown-field/type.snap: -------------------------------------------------------------------------------- 1 | stdout = '' 2 | stderr = ''' 3 | error: cannot find `foo` in expression 4 | ┌─ tests/fail/elaboration/unknown-field/type.fathom:3:6 5 | │ 6 | 3 │ Type.foo 7 | │ ---- ^^^ unknown label 8 | │ │ 9 | │ expression of type Type 10 | │ 11 | = help: did you mean `foo`? 12 | 13 | ''' 14 | -------------------------------------------------------------------------------- /tests/fail/elaboration/unknown-field/unbound-head.fathom: -------------------------------------------------------------------------------- 1 | //~ exit-code = 1 2 | 3 | rec.foo.bar 4 | -------------------------------------------------------------------------------- /tests/fail/elaboration/unknown-field/unbound-head.snap: -------------------------------------------------------------------------------- 1 | stdout = '' 2 | stderr = ''' 3 | error: cannot find `rec` in scope 4 | ┌─ tests/fail/elaboration/unknown-field/unbound-head.fathom:3:1 5 | │ 6 | 3 │ rec.foo.bar 7 | │ ^^^ unbound name 8 | 9 | ''' 10 | -------------------------------------------------------------------------------- /tests/fail/elaboration/unknown-field/unit-literal.fathom: -------------------------------------------------------------------------------- 1 | //~ exit-code = 1 2 | 3 | {}.goodbye 4 | -------------------------------------------------------------------------------- /tests/fail/elaboration/unknown-field/unit-literal.snap: -------------------------------------------------------------------------------- 1 | stdout = '' 2 | stderr = ''' 3 | error: cannot find `goodbye` in expression 4 | ┌─ tests/fail/elaboration/unknown-field/unit-literal.fathom:3:4 5 | │ 6 | 3 │ {}.goodbye 7 | │ -- ^^^^^^^ unknown label 8 | │ │ 9 | │ expression of type () 10 | │ 11 | = help: did you mean `goodbye`? 12 | 13 | ''' 14 | -------------------------------------------------------------------------------- /tests/fail/elaboration/unsolved/fun-literal-param-type.fathom: -------------------------------------------------------------------------------- 1 | //~ allow-errors = true 2 | 3 | fun a => a 4 | -------------------------------------------------------------------------------- /tests/fail/elaboration/unsolved/fun-literal-param-type.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | fun a => a : ?0 -> ?0 3 | ''' 4 | stderr = ''' 5 | error: failed to infer named pattern type 6 | ┌─ tests/fail/elaboration/unsolved/fun-literal-param-type.fathom:3:5 7 | │ 8 | 3 │ fun a => a 9 | │ ^ unsolved named pattern type 10 | 11 | ''' 12 | -------------------------------------------------------------------------------- /tests/fail/elaboration/unsolved/fun-literal-placeholder-body-type.fathom: -------------------------------------------------------------------------------- 1 | //~ allow-errors = true 2 | 3 | fun (A : Type) a (b : A) => a : fun (A : Type) -> _ 4 | -------------------------------------------------------------------------------- /tests/fail/elaboration/unsolved/fun-literal-placeholder-body-type.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | fun A a b => a : fun (A : Type) -> ?2 A -> A -> ?2 A 3 | ''' 4 | stderr = ''' 5 | error: failed to infer named pattern type 6 | ┌─ tests/fail/elaboration/unsolved/fun-literal-placeholder-body-type.fathom:3:16 7 | │ 8 | 3 │ fun (A : Type) a (b : A) => a : fun (A : Type) -> _ 9 | │ ^ unsolved named pattern type 10 | 11 | ''' 12 | -------------------------------------------------------------------------------- /tests/fail/elaboration/unsolved/hole-ann.fathom: -------------------------------------------------------------------------------- 1 | //~ allow-errors = true 2 | 3 | ?woopsie : Type 4 | -------------------------------------------------------------------------------- /tests/fail/elaboration/unsolved/hole-ann.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | ?woopsie : Type 3 | ''' 4 | stderr = ''' 5 | error: failed to infer hole expression 6 | ┌─ tests/fail/elaboration/unsolved/hole-ann.fathom:3:1 7 | │ 8 | 3 │ ?woopsie : Type 9 | │ ^^^^^^^^ unsolved hole expression 10 | 11 | ''' 12 | -------------------------------------------------------------------------------- /tests/fail/elaboration/unsolved/hole.fathom: -------------------------------------------------------------------------------- 1 | //~ allow-errors = true 2 | 3 | ?woopsie 4 | -------------------------------------------------------------------------------- /tests/fail/elaboration/unsolved/hole.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | ?woopsie : ?0 3 | ''' 4 | stderr = ''' 5 | error: failed to infer hole expression 6 | ┌─ tests/fail/elaboration/unsolved/hole.fathom:3:1 7 | │ 8 | 3 │ ?woopsie 9 | │ ^^^^^^^^ unsolved hole expression 10 | 11 | ''' 12 | -------------------------------------------------------------------------------- /tests/fail/elaboration/unsolved/placeholder-ann.fathom: -------------------------------------------------------------------------------- 1 | //~ allow-errors = true 2 | 3 | _ : Type 4 | -------------------------------------------------------------------------------- /tests/fail/elaboration/unsolved/placeholder-ann.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | ?1 : Type 3 | ''' 4 | stderr = ''' 5 | error: failed to infer placeholder expression 6 | ┌─ tests/fail/elaboration/unsolved/placeholder-ann.fathom:3:1 7 | │ 8 | 3 │ _ : Type 9 | │ ^ unsolved placeholder expression 10 | 11 | ''' 12 | -------------------------------------------------------------------------------- /tests/fail/elaboration/unsolved/placeholder.fathom: -------------------------------------------------------------------------------- 1 | //~ allow-errors = true 2 | 3 | _ 4 | -------------------------------------------------------------------------------- /tests/fail/elaboration/unsolved/placeholder.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | ?1 : ?0 3 | ''' 4 | stderr = ''' 5 | error: failed to infer placeholder expression 6 | ┌─ tests/fail/elaboration/unsolved/placeholder.fathom:3:1 7 | │ 8 | 3 │ _ 9 | │ ^ unsolved placeholder expression 10 | 11 | ''' 12 | -------------------------------------------------------------------------------- /tests/fail/parse/error-recovery.fathom: -------------------------------------------------------------------------------- 1 | //~ exit-code = 1 2 | 3 | let x : Type = {; 4 | 5 | x : Type -> Type 6 | -------------------------------------------------------------------------------- /tests/fail/parse/error-recovery.snap: -------------------------------------------------------------------------------- 1 | stdout = '' 2 | stderr = ''' 3 | error: unexpected token ; 4 | ┌─ tests/fail/parse/error-recovery.fathom:3:17 5 | │ 6 | 3 │ let x : Type = {; 7 | │ ^ unexpected token 8 | │ 9 | = expected "let", "name" or "}" 10 | 11 | error: mismatched types 12 | ┌─ tests/fail/parse/error-recovery.fathom:5:1 13 | │ 14 | 5 │ x : Type -> Type 15 | │ ^ type mismatch, expected `Type -> Type`, found `Type` 16 | │ 17 | = expected `Type -> Type` 18 | found `Type` 19 | 20 | ''' 21 | -------------------------------------------------------------------------------- /tests/fail/parse/unclosed-block-comment.fathom: -------------------------------------------------------------------------------- 1 | //~ exit-code = 1 2 | 3 | {} 4 | /* a 5 | /* b 6 | /* c 7 | 8 | */ c 9 | */ b 10 | // a 11 | -------------------------------------------------------------------------------- /tests/fail/parse/unclosed-block-comment.snap: -------------------------------------------------------------------------------- 1 | stdout = '' 2 | stderr = ''' 3 | error: unclosed block comment 4 | ┌─ tests/fail/parse/unclosed-block-comment.fathom:4:1 5 | │ 6 | 4 │ /* a 7 | │ ^^ first `/*` 8 | · 9 | 9 │ */ b 10 | │ ^^ last `*/` 11 | │ 12 | = help: 1 more `*/` needed 13 | 14 | ''' 15 | -------------------------------------------------------------------------------- /tests/fail/parse/unexpected-character.fathom: -------------------------------------------------------------------------------- 1 | //~ exit-code = 1 2 | 3 | 🥸 4 | -------------------------------------------------------------------------------- /tests/fail/parse/unexpected-character.snap: -------------------------------------------------------------------------------- 1 | stdout = '' 2 | stderr = ''' 3 | error: unexpected character 4 | ┌─ tests/fail/parse/unexpected-character.fathom:3:1 5 | │ 6 | 3 │ 🥸 7 | │ ^^ 8 | 9 | ''' 10 | -------------------------------------------------------------------------------- /tests/succeed/ann/array-literal-array.fathom: -------------------------------------------------------------------------------- 1 | [1, 2, 60, 73] : Array S32 2 | -------------------------------------------------------------------------------- /tests/succeed/ann/array-literal-array.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | [1, 2, 60, 73] : Array S32 3 | ''' 4 | stderr = '' 5 | -------------------------------------------------------------------------------- /tests/succeed/ann/array-literal-array16.fathom: -------------------------------------------------------------------------------- 1 | [] : Array16 0 U32 2 | -------------------------------------------------------------------------------- /tests/succeed/ann/array-literal-array16.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | [] : Array16 0 U32 3 | ''' 4 | stderr = '' 5 | -------------------------------------------------------------------------------- /tests/succeed/ann/array-literal-array32.fathom: -------------------------------------------------------------------------------- 1 | [1, 2, 3] : Array32 3 U32 2 | -------------------------------------------------------------------------------- /tests/succeed/ann/array-literal-array32.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | [1, 2, 3] : Array32 3 U32 3 | ''' 4 | stderr = '' 5 | -------------------------------------------------------------------------------- /tests/succeed/ann/array-literal-array64.fathom: -------------------------------------------------------------------------------- 1 | [1, 2, 3] : Array64 3 U32 2 | -------------------------------------------------------------------------------- /tests/succeed/ann/array-literal-array64.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | [1, 2, 3] : Array64 3 U32 3 | ''' 4 | stderr = '' 5 | -------------------------------------------------------------------------------- /tests/succeed/ann/array-literal-array8.fathom: -------------------------------------------------------------------------------- 1 | [3, 4] : Array8 2 U32 2 | -------------------------------------------------------------------------------- /tests/succeed/ann/array-literal-array8.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | [3, 4] : Array8 2 U32 3 | ''' 4 | stderr = '' 5 | -------------------------------------------------------------------------------- /tests/succeed/ann/arrow-type-type.fathom: -------------------------------------------------------------------------------- 1 | Type -> Type : Type 2 | -------------------------------------------------------------------------------- /tests/succeed/ann/arrow-type-type.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | Type -> Type : Type 3 | ''' 4 | stderr = '' 5 | -------------------------------------------------------------------------------- /tests/succeed/ann/fun-literal-identity-mono-input-ann-placeholder.fathom: -------------------------------------------------------------------------------- 1 | fun (a : _) => a : Type -> Type 2 | -------------------------------------------------------------------------------- /tests/succeed/ann/fun-literal-identity-mono-input-ann-placeholder.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | fun a => a : Type -> Type 3 | ''' 4 | stderr = '' 5 | -------------------------------------------------------------------------------- /tests/succeed/ann/fun-literal-identity-mono-input-ann-type.fathom: -------------------------------------------------------------------------------- 1 | fun (a : Type) => a : Type -> Type 2 | -------------------------------------------------------------------------------- /tests/succeed/ann/fun-literal-identity-mono-input-ann-type.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | fun a => a : Type -> Type 3 | ''' 4 | stderr = '' 5 | -------------------------------------------------------------------------------- /tests/succeed/ann/fun-literal-identity-mono.fathom: -------------------------------------------------------------------------------- 1 | fun a => a : Type -> Type 2 | -------------------------------------------------------------------------------- /tests/succeed/ann/fun-literal-identity-mono.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | fun a => a : Type -> Type 3 | ''' 4 | stderr = '' 5 | -------------------------------------------------------------------------------- /tests/succeed/ann/fun-literal-identity-poly-input-placeholder.fathom: -------------------------------------------------------------------------------- 1 | fun _ => fun a => a : fun (A : Type) -> A -> A 2 | -------------------------------------------------------------------------------- /tests/succeed/ann/fun-literal-identity-poly-input-placeholder.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | fun _ a => a : fun (A : Type) -> A -> A 3 | ''' 4 | stderr = '' 5 | -------------------------------------------------------------------------------- /tests/succeed/ann/fun-literal-identity-poly-sugar.fathom: -------------------------------------------------------------------------------- 1 | fun A a => a : fun (A : Type) -> A -> A 2 | -------------------------------------------------------------------------------- /tests/succeed/ann/fun-literal-identity-poly-sugar.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | fun A a => a : fun (A : Type) -> A -> A 3 | ''' 4 | stderr = '' 5 | -------------------------------------------------------------------------------- /tests/succeed/ann/fun-literal-identity-poly.fathom: -------------------------------------------------------------------------------- 1 | fun A => fun a => a : fun (A : Type) -> A -> A 2 | -------------------------------------------------------------------------------- /tests/succeed/ann/fun-literal-identity-poly.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | fun A a => a : fun (A : Type) -> A -> A 3 | ''' 4 | stderr = '' 5 | -------------------------------------------------------------------------------- /tests/succeed/ann/fun-literal-placeholder-body-type.fathom: -------------------------------------------------------------------------------- 1 | fun (A : Type) (a : A) => a : fun (A : Type) -> _ 2 | -------------------------------------------------------------------------------- /tests/succeed/ann/fun-literal-placeholder-body-type.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | fun A a => a : fun (A : Type) -> A -> A 3 | ''' 4 | stderr = '' 5 | -------------------------------------------------------------------------------- /tests/succeed/ann/fun-type-identity-mono.fathom: -------------------------------------------------------------------------------- 1 | fun (A : Type) -> Type : Type 2 | -------------------------------------------------------------------------------- /tests/succeed/ann/fun-type-identity-mono.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | Type -> Type : Type 3 | ''' 4 | stderr = '' 5 | -------------------------------------------------------------------------------- /tests/succeed/ann/fun-type-identity-poly-hole.fathom: -------------------------------------------------------------------------------- 1 | fun (A : _) -> A -> A : Type 2 | -------------------------------------------------------------------------------- /tests/succeed/ann/fun-type-identity-poly-hole.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | fun (A : Type) -> A -> A : Type 3 | ''' 4 | stderr = '' 5 | -------------------------------------------------------------------------------- /tests/succeed/ann/fun-type-identity-poly.fathom: -------------------------------------------------------------------------------- 1 | fun (A : Type) -> A -> A : Type 2 | -------------------------------------------------------------------------------- /tests/succeed/ann/fun-type-identity-poly.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | fun (A : Type) -> A -> A : Type 3 | ''' 4 | stderr = '' 5 | -------------------------------------------------------------------------------- /tests/succeed/ann/record-literal-pair-dependent.fathom: -------------------------------------------------------------------------------- 1 | { 2 | A = { x : Type }, 3 | a = { x = {} }, 4 | } : { 5 | A : Type, 6 | a : A, 7 | } 8 | -------------------------------------------------------------------------------- /tests/succeed/ann/record-literal-pair-dependent.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | { A = { x : Type }, a = { x = () } } : { A : Type, a : A } 3 | ''' 4 | stderr = '' 5 | -------------------------------------------------------------------------------- /tests/succeed/ann/record-literal-pair.fathom: -------------------------------------------------------------------------------- 1 | { 2 | first = {}, 3 | second = Type, 4 | } : { 5 | first : Type, 6 | second : Type, 7 | } 8 | -------------------------------------------------------------------------------- /tests/succeed/ann/record-literal-pair.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | { first = (), second = Type } : { first : Type, second : Type } 3 | ''' 4 | stderr = '' 5 | -------------------------------------------------------------------------------- /tests/succeed/ann/record-type-pair.fathom: -------------------------------------------------------------------------------- 1 | { first : Type, second : Type } : Type 2 | -------------------------------------------------------------------------------- /tests/succeed/ann/record-type-pair.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | { first : Type, second : Type } : Type 3 | ''' 4 | stderr = '' 5 | -------------------------------------------------------------------------------- /tests/succeed/ann/string-literal-char.fathom: -------------------------------------------------------------------------------- 1 | "BEN " : U32 2 | -------------------------------------------------------------------------------- /tests/succeed/ann/string-literal-char.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | "BEN " : U32 3 | ''' 4 | stderr = '' 5 | -------------------------------------------------------------------------------- /tests/succeed/ann/type.fathom: -------------------------------------------------------------------------------- 1 | Type : Type 2 | -------------------------------------------------------------------------------- /tests/succeed/ann/type.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | Type : Type 3 | ''' 4 | stderr = '' 5 | -------------------------------------------------------------------------------- /tests/succeed/ann/unit-literal-expr.fathom: -------------------------------------------------------------------------------- 1 | {} : {} 2 | -------------------------------------------------------------------------------- /tests/succeed/ann/unit-literal-expr.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | () : () 3 | ''' 4 | stderr = '' 5 | -------------------------------------------------------------------------------- /tests/succeed/ann/unit-literal-format.fathom: -------------------------------------------------------------------------------- 1 | {} : Format 2 | -------------------------------------------------------------------------------- /tests/succeed/ann/unit-literal-format.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | () : Format 3 | ''' 4 | stderr = '' 5 | -------------------------------------------------------------------------------- /tests/succeed/ann/unit-literal-type.fathom: -------------------------------------------------------------------------------- 1 | {} : Type 2 | -------------------------------------------------------------------------------- /tests/succeed/ann/unit-literal-type.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | () : Type 3 | ''' 4 | stderr = '' 5 | -------------------------------------------------------------------------------- /tests/succeed/arrow/identity.fathom: -------------------------------------------------------------------------------- 1 | Type -> Type 2 | -------------------------------------------------------------------------------- /tests/succeed/arrow/identity.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | Type -> Type : Type 3 | ''' 4 | stderr = '' 5 | -------------------------------------------------------------------------------- /tests/succeed/distillation/fresh-names.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | def a : () = (); 3 | def const1 : fun (@A : Type) (@B : Type) -> A -> B -> A = 4 | fun @b @c x y => let x1 : b = x; 5 | let y1 : c = y; 6 | x; 7 | def const2 : fun (@A : Type) (@B : Type) -> A -> B -> A = let b : () = (); 8 | fun @c @d x y => let x1 : c = x; 9 | let y1 : d = y; 10 | x; 11 | ''' 12 | stderr = '' 13 | -------------------------------------------------------------------------------- /tests/succeed/format-cond/simple.fathom: -------------------------------------------------------------------------------- 1 | let format = { sfnt_version <- { version <- u32be | (u32_eq version 0xffff) } }; 2 | 3 | let _ : Repr format -> { sfnt_version : Repr u32be } = 4 | fun x => x; 5 | 6 | {} 7 | -------------------------------------------------------------------------------- /tests/succeed/format-cond/simple.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | let format : Format = { 3 | sfnt_version <- { version <- u32be | version == (0xffff : U32) }, 4 | }; 5 | let _ : Repr format -> { sfnt_version : Repr u32be } = fun x => x; 6 | () : () 7 | ''' 8 | stderr = '' 9 | -------------------------------------------------------------------------------- /tests/succeed/format-deref/simple.fathom: -------------------------------------------------------------------------------- 1 | { 2 | start <- stream_pos, 3 | link <- link start u16be, 4 | len <- deref link, 5 | _reserved <- u16be, 6 | data <- repeat_len16 len u16be, 7 | } 8 | -------------------------------------------------------------------------------- /tests/succeed/format-deref/simple.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | { 3 | start <- stream_pos, 4 | link <- link start u16be, 5 | len <- deref @u16be link, 6 | _reserved <- u16be, 7 | data <- repeat_len16 len u16be, 8 | } : Format 9 | ''' 10 | stderr = '' 11 | -------------------------------------------------------------------------------- /tests/succeed/format-overlap/dependent.fathom: -------------------------------------------------------------------------------- 1 | // This is kind of a pointless example to show dependencies between overlapped 2 | // formats. More compelling examples once we add more language features. 3 | 4 | let record0 = { 5 | length <- u8, 6 | }; 7 | 8 | let record1 = fun (length : U8) => { 9 | _length <- u8, // Skip length 10 | data <- repeat_len8 length u8, 11 | }; 12 | 13 | let silly = overlap { 14 | record0 <- record0, 15 | record1 <- record1 record0.length, 16 | }; 17 | 18 | let _ : 19 | Repr silly -> { 20 | record0 : { length : U8 }, 21 | record1 : { _length : U8, data : Array8 record0.length U8 }, 22 | } 23 | = fun silly => silly; 24 | 25 | {} 26 | -------------------------------------------------------------------------------- /tests/succeed/format-overlap/dependent.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | let record0 : Format = { length <- u8 }; 3 | let record1 : U8 -> Format = fun length => { 4 | _length <- u8, 5 | data <- repeat_len8 length u8, 6 | }; 7 | let silly : Format = overlap { 8 | record0 <- record0, 9 | record1 <- record1 record0.length, 10 | }; 11 | let _ : Repr silly -> { 12 | record0 : { length : U8 }, 13 | record1 : { _length : U8, data : Array8 record0.length U8 }, 14 | } = fun silly => silly; 15 | () : () 16 | ''' 17 | stderr = '' 18 | -------------------------------------------------------------------------------- /tests/succeed/format-overlap/field-refinements.fathom: -------------------------------------------------------------------------------- 1 | let number = overlap { 2 | u <- u32be where u32_gte u 2, 3 | s <- s32be, 4 | }; 5 | 6 | let _ : Repr number -> { u : U32, s : S32 } = 7 | fun n => n; 8 | 9 | {} 10 | -------------------------------------------------------------------------------- /tests/succeed/format-overlap/field-refinements.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | let number : Format = overlap { u <- u32be where u >= (2 : U32), s <- s32be }; 3 | let _ : Repr number -> { u : U32, s : S32 } = fun n => n; 4 | () : () 5 | ''' 6 | stderr = '' 7 | -------------------------------------------------------------------------------- /tests/succeed/format-overlap/numbers.fathom: -------------------------------------------------------------------------------- 1 | let number = overlap { 2 | u <- u32be, 3 | s <- s32be, 4 | }; 5 | 6 | let _ : Repr number -> { u : U32, s : S32 } = 7 | fun n => n; 8 | 9 | {} 10 | -------------------------------------------------------------------------------- /tests/succeed/format-overlap/numbers.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | let number : Format = overlap { u <- u32be, s <- s32be }; 3 | let _ : Repr number -> { u : U32, s : S32 } = fun n => n; 4 | () : () 5 | ''' 6 | stderr = '' 7 | -------------------------------------------------------------------------------- /tests/succeed/format-record/computed-fields.fathom: -------------------------------------------------------------------------------- 1 | let format = { 2 | /// 2 × seg_count. 3 | seg_count_x2 <- u16be, 4 | 5 | /// Number of contiguous ranges of character codes 6 | let seg_count = u16_div seg_count_x2 2, 7 | 8 | start_code <- repeat_len16 seg_count u16be, 9 | id_delta <- repeat_len16 seg_count s16be, 10 | }; 11 | 12 | let _ : Repr format -> { 13 | seg_count_x2 : U16, 14 | seg_count : U16, 15 | start_code : Array16 seg_count U16, 16 | id_delta : Array16 seg_count S16, 17 | } = fun x => x; 18 | 19 | let format = { 20 | // test annotation 21 | let x : U32 = 256, 22 | }; 23 | 24 | let _ : Repr format -> { x : U32 } = 25 | fun x => x; 26 | 27 | {} 28 | -------------------------------------------------------------------------------- /tests/succeed/format-record/computed-fields.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | let format : Format = { 3 | seg_count_x2 <- u16be, 4 | let seg_count : U16 = seg_count_x2 / (2 : U16), 5 | start_code <- repeat_len16 seg_count u16be, 6 | id_delta <- repeat_len16 seg_count s16be, 7 | }; 8 | let _ : Repr format -> { 9 | seg_count_x2 : U16, 10 | seg_count : U16, 11 | start_code : Array16 seg_count U16, 12 | id_delta : Array16 seg_count S16, 13 | } = fun x => x; 14 | let format : Format = { let x : U32 = 256 }; 15 | let _ : Repr format -> { x : U32 } = fun x => x; 16 | () : () 17 | ''' 18 | stderr = '' 19 | -------------------------------------------------------------------------------- /tests/succeed/format-record/field-refinements.fathom: -------------------------------------------------------------------------------- 1 | let format = { 2 | magic <- u64le where u64_eq magic 0x00ffffffffffff00, 3 | len <- u8 where u8_lte len 16, 4 | data <- repeat_len8 len u8, 5 | }; 6 | 7 | let _ : Repr format -> { magic : U64, len : U8, data : Array8 len U8 } = 8 | fun x => x; 9 | 10 | {} 11 | -------------------------------------------------------------------------------- /tests/succeed/format-record/field-refinements.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | let format : Format = { 3 | magic <- u64le where magic == (0xffffffffffff00 : U64), 4 | len <- u8 where len <= (16 : U8), 5 | data <- repeat_len8 len u8, 6 | }; 7 | let _ : Repr format -> { magic : U64, len : U8, data : Array8 len U8 } = 8 | fun x => x; 9 | () : () 10 | ''' 11 | stderr = '' 12 | -------------------------------------------------------------------------------- /tests/succeed/format-record/pair-dependent.fathom: -------------------------------------------------------------------------------- 1 | // TODO: Use builtin `repeat_len32` format. 2 | let repeat_len32 : U32 -> Format -> Format 3 | = fun len => fun Elem => Elem; 4 | 5 | let pair = { 6 | len <- u32be, 7 | data <- repeat_len32 len u32be, 8 | }; 9 | 10 | pair 11 | -------------------------------------------------------------------------------- /tests/succeed/format-record/pair-dependent.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | let repeat_len32 : U32 -> Format -> Format = fun len Elem => Elem; 3 | let pair : Format = { len <- u32be, data <- repeat_len32 len u32be }; 4 | pair : Format 5 | ''' 6 | stderr = '' 7 | -------------------------------------------------------------------------------- /tests/succeed/format-record/pair.fathom: -------------------------------------------------------------------------------- 1 | let pair = { 2 | fst <- u32be, 3 | snd <- u32be, 4 | }; 5 | 6 | pair 7 | -------------------------------------------------------------------------------- /tests/succeed/format-record/pair.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | let pair : Format = { fst <- u32be, snd <- u32be }; pair : Format 3 | ''' 4 | stderr = '' 5 | -------------------------------------------------------------------------------- /tests/succeed/format-repr/coercions.fathom: -------------------------------------------------------------------------------- 1 | let num : Format = s32be; 2 | 3 | let x : num = 3; 4 | 5 | let Point : Type = { 6 | x : num, 7 | y : num, 8 | }; 9 | 10 | x : S32 11 | -------------------------------------------------------------------------------- /tests/succeed/format-repr/coercions.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | let num : Format = s32be; 3 | let x : Repr num = 3; 4 | let Point : Type = { x : Repr num, y : Repr num }; 5 | x : S32 6 | ''' 7 | stderr = '' 8 | -------------------------------------------------------------------------------- /tests/succeed/format-repr/pair-dependent.fathom: -------------------------------------------------------------------------------- 1 | // TODO: Use builtin `repeat_len32` format. 2 | let repeat_len32 : U32 -> Format -> Format 3 | = fun len => fun Elem => Elem; 4 | 5 | let pair = { 6 | len <- u32be, 7 | data <- repeat_len32 len u32be, 8 | }; 9 | 10 | let test_pair : Repr pair -> { len : U32, data : U32 } 11 | = fun p => p; 12 | 13 | pair 14 | -------------------------------------------------------------------------------- /tests/succeed/format-repr/pair-dependent.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | let repeat_len32 : U32 -> Format -> Format = fun len Elem => Elem; 3 | let pair : Format = { len <- u32be, data <- repeat_len32 len u32be }; 4 | let test_pair : Repr pair -> { len : U32, data : U32 } = fun p => p; 5 | pair : Format 6 | ''' 7 | stderr = '' 8 | -------------------------------------------------------------------------------- /tests/succeed/format-repr/record.fathom: -------------------------------------------------------------------------------- 1 | let pair = { 2 | fst <- u32be, 3 | snd <- u32be, 4 | }; 5 | 6 | let test_pair : Repr pair -> { fst : U32, snd : U32 } 7 | = fun p => p; 8 | 9 | let test_pair : Repr pair -> { fst : U32, snd : U32 } 10 | = fun p => { fst = p.fst, snd = p.snd }; 11 | 12 | pair 13 | -------------------------------------------------------------------------------- /tests/succeed/format-repr/record.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | let pair : Format = { fst <- u32be, snd <- u32be }; 3 | let test_pair : Repr pair -> { fst : U32, snd : U32 } = fun p => p; 4 | let test_pair : Repr pair -> { fst : U32, snd : U32 } = fun p => { 5 | fst = p.fst, 6 | snd = p.snd, 7 | }; 8 | pair : Format 9 | ''' 10 | stderr = '' 11 | -------------------------------------------------------------------------------- /tests/succeed/format-repr/unit-literal.fathom: -------------------------------------------------------------------------------- 1 | let unit : Format = {}; 2 | 3 | let test_unit : Repr unit -> {} 4 | = fun p => p; 5 | 6 | let test_unit : Repr unit -> {} 7 | = fun p => {}; 8 | 9 | unit 10 | -------------------------------------------------------------------------------- /tests/succeed/format-repr/unit-literal.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | let unit : Format = (); 3 | let test_unit : Repr unit -> () = fun p => p; 4 | let test_unit : Repr unit -> () = fun p => (); 5 | unit : Format 6 | ''' 7 | stderr = '' 8 | -------------------------------------------------------------------------------- /tests/succeed/fun-elim/ann-identity-mono-0.fathom: -------------------------------------------------------------------------------- 1 | (fun a => a : Type -> Type) Type 2 | -------------------------------------------------------------------------------- /tests/succeed/fun-elim/ann-identity-mono-0.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | (fun a => a : Type -> Type) Type : Type 3 | ''' 4 | stderr = '' 5 | -------------------------------------------------------------------------------- /tests/succeed/fun-elim/ann-identity-mono-1.fathom: -------------------------------------------------------------------------------- 1 | (fun a => a : (Type -> Type) -> (Type -> Type)) (fun a => a) Type 2 | -------------------------------------------------------------------------------- /tests/succeed/fun-elim/ann-identity-mono-1.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | (fun a => a : (Type -> Type) -> Type -> Type) (fun a => a) Type : Type 3 | ''' 4 | stderr = '' 5 | -------------------------------------------------------------------------------- /tests/succeed/fun-elim/ann-identity-mono-2.fathom: -------------------------------------------------------------------------------- 1 | (fun a => a : (Type -> Type) -> _) (fun a => a) Type 2 | -------------------------------------------------------------------------------- /tests/succeed/fun-elim/ann-identity-mono-2.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | (fun a => a : (Type -> Type) -> Type -> Type) (fun a => a) Type : Type 3 | ''' 4 | stderr = '' 5 | -------------------------------------------------------------------------------- /tests/succeed/fun-elim/ann-identity-poly-0.fathom: -------------------------------------------------------------------------------- 1 | (fun A => fun a => a : fun (A : Type) -> A -> A) Type Type 2 | -------------------------------------------------------------------------------- /tests/succeed/fun-elim/ann-identity-poly-0.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | (fun A a => a : fun (A : Type) -> A -> A) Type Type : Type 3 | ''' 4 | stderr = '' 5 | -------------------------------------------------------------------------------- /tests/succeed/fun-elim/ann-identity-poly-1.fathom: -------------------------------------------------------------------------------- 1 | (fun A => fun a => a : fun (A : Type) -> A -> A) (Type -> Type) (fun a => a) 2 | -------------------------------------------------------------------------------- /tests/succeed/fun-elim/ann-identity-poly-1.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | (fun A a => a : fun (A : Type) -> A -> A) (Type -> Type) (fun a => a) : Type -> 3 | Type 4 | ''' 5 | stderr = '' 6 | -------------------------------------------------------------------------------- /tests/succeed/fun-elim/identity-mono-0.fathom: -------------------------------------------------------------------------------- 1 | (fun a => a) Type 2 | -------------------------------------------------------------------------------- /tests/succeed/fun-elim/identity-mono-0.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | (fun a => a) Type : Type 3 | ''' 4 | stderr = '' 5 | -------------------------------------------------------------------------------- /tests/succeed/fun-elim/identity-mono-1.fathom: -------------------------------------------------------------------------------- 1 | (fun a => a) (fun a => a) Type 2 | -------------------------------------------------------------------------------- /tests/succeed/fun-elim/identity-mono-1.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | (fun a => a) (fun a => a) Type : Type 3 | ''' 4 | stderr = '' 5 | -------------------------------------------------------------------------------- /tests/succeed/fun-literal/identity-mono.fathom: -------------------------------------------------------------------------------- 1 | fun (a : Type) => a 2 | -------------------------------------------------------------------------------- /tests/succeed/fun-literal/identity-mono.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | fun a => a : Type -> Type 3 | ''' 4 | stderr = '' 5 | -------------------------------------------------------------------------------- /tests/succeed/fun-literal/identity-poly-sugar.fathom: -------------------------------------------------------------------------------- 1 | fun A (a : A) => a 2 | -------------------------------------------------------------------------------- /tests/succeed/fun-literal/identity-poly-sugar.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | fun A a => a : fun (A : Type) -> A -> A 3 | ''' 4 | stderr = '' 5 | -------------------------------------------------------------------------------- /tests/succeed/fun-literal/identity-poly.fathom: -------------------------------------------------------------------------------- 1 | fun A => fun (a : A) => a 2 | -------------------------------------------------------------------------------- /tests/succeed/fun-literal/identity-poly.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | fun A a => a : fun (A : Type) -> A -> A 3 | ''' 4 | stderr = '' 5 | -------------------------------------------------------------------------------- /tests/succeed/fun-type/identity-mono.fathom: -------------------------------------------------------------------------------- 1 | fun (A : Type) -> Type 2 | -------------------------------------------------------------------------------- /tests/succeed/fun-type/identity-mono.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | Type -> Type : Type 3 | ''' 4 | stderr = '' 5 | -------------------------------------------------------------------------------- /tests/succeed/fun-type/identity-poly-arrow.fathom: -------------------------------------------------------------------------------- 1 | fun (A : Type) -> A -> A 2 | -------------------------------------------------------------------------------- /tests/succeed/fun-type/identity-poly-arrow.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | fun (A : Type) -> A -> A : Type 3 | ''' 4 | stderr = '' 5 | -------------------------------------------------------------------------------- /tests/succeed/fun-type/identity-poly-input-ann-placeholder.fathom: -------------------------------------------------------------------------------- 1 | fun (A : _) -> A -> A 2 | -------------------------------------------------------------------------------- /tests/succeed/fun-type/identity-poly-input-ann-placeholder.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | fun (A : Type) -> A -> A : Type 3 | ''' 4 | stderr = '' 5 | -------------------------------------------------------------------------------- /tests/succeed/fun-type/identity-poly-input-placeholder.fathom: -------------------------------------------------------------------------------- 1 | fun (A : Type) -> fun (_ : A) -> A 2 | -------------------------------------------------------------------------------- /tests/succeed/fun-type/identity-poly-input-placeholder.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | fun (A : Type) -> A -> A : Type 3 | ''' 4 | stderr = '' 5 | -------------------------------------------------------------------------------- /tests/succeed/fun-type/identity-poly-sugar.fathom: -------------------------------------------------------------------------------- 1 | fun (A : Type) (a : A) -> A 2 | -------------------------------------------------------------------------------- /tests/succeed/fun-type/identity-poly-sugar.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | fun (A : Type) -> A -> A : Type 3 | ''' 4 | stderr = '' 5 | -------------------------------------------------------------------------------- /tests/succeed/fun-type/identity-poly.fathom: -------------------------------------------------------------------------------- 1 | fun (A : Type) -> fun (a : A) -> A 2 | -------------------------------------------------------------------------------- /tests/succeed/fun-type/identity-poly.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | fun (A : Type) -> A -> A : Type 3 | ''' 4 | stderr = '' 5 | -------------------------------------------------------------------------------- /tests/succeed/hole/hole-0.fathom: -------------------------------------------------------------------------------- 1 | fun (A : ?universe) -> A 2 | -------------------------------------------------------------------------------- /tests/succeed/hole/hole-0.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | fun (A : Type) -> A : Type 3 | ''' 4 | stderr = ''' 5 | note: solution found for hole `?universe` 6 | ┌─ tests/succeed/hole/hole-0.fathom:1:10 7 | │ 8 | 1 │ fun (A : ?universe) -> A 9 | │ ^^^^^^^^^ solution found 10 | │ 11 | = hole `?universe` can be replaced with `Type` 12 | 13 | ''' 14 | -------------------------------------------------------------------------------- /tests/succeed/hole/hole-1.fathom: -------------------------------------------------------------------------------- 1 | (fun a => a : ?fun_type) Type 2 | -------------------------------------------------------------------------------- /tests/succeed/hole/hole-1.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | (fun a => a : Type -> Type) Type : Type 3 | ''' 4 | stderr = ''' 5 | note: solution found for hole `?fun_type` 6 | ┌─ tests/succeed/hole/hole-1.fathom:1:15 7 | │ 8 | 1 │ (fun a => a : ?fun_type) Type 9 | │ ^^^^^^^^^ solution found 10 | │ 11 | = hole `?fun_type` can be replaced with `Type -> Type` 12 | 13 | ''' 14 | -------------------------------------------------------------------------------- /tests/succeed/if-then-else/check.fathom: -------------------------------------------------------------------------------- 1 | (if true then 1 else 0) : U8 -------------------------------------------------------------------------------- /tests/succeed/if-then-else/check.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | if true then 1 else 0 : U8 3 | ''' 4 | stderr = '' 5 | -------------------------------------------------------------------------------- /tests/succeed/if-then-else/pretty.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | let _ : U32 = if false then 1 else 0; 3 | let _ : U32 = if (if false then true else false) 4 | then if true then 0 else 1 5 | else if false then 2 6 | else 3; 7 | let _ : U32 = if false 8 | then 0 9 | else if false then 0 10 | else if false then 0 11 | else if false then 0 12 | else if false then 0 13 | else if false then 0 14 | else if false then 0 15 | else if false then 0 16 | else if false then 0 17 | else if false then 0 18 | else if false then 0 19 | else if false then 0 20 | else if false then 0 21 | else if false then 0 22 | else if false then 0 23 | else 0; 24 | () : () 25 | ''' 26 | stderr = '' 27 | -------------------------------------------------------------------------------- /tests/succeed/if-then-else/synth.fathom: -------------------------------------------------------------------------------- 1 | if true then (1 : U8) else 0 -------------------------------------------------------------------------------- /tests/succeed/if-then-else/synth.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | if true then 1 else 0 : U8 3 | ''' 4 | stderr = '' 5 | -------------------------------------------------------------------------------- /tests/succeed/implicit-args/generalize.fathom: -------------------------------------------------------------------------------- 1 | let id : fun (@A : Type) -> A -> A = fun a => a; 2 | let always : fun (@A : Type) (@B : Type) -> A -> B -> A = fun a b => a; 3 | let apply : fun (@A : Type) (@B : Type) -> (A -> B) -> A -> B = fun f x => f x; 4 | {} 5 | -------------------------------------------------------------------------------- /tests/succeed/implicit-args/generalize.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | let id : fun (@A : Type) -> A -> A = fun @A a => a; 3 | let always : fun (@A : Type) (@B : Type) -> A -> B -> A = fun @A @B a b => a; 4 | let apply : fun (@A : Type) (@B : Type) -> (A -> B) -> A -> B = 5 | fun @A @B f x => f x; 6 | () : () 7 | ''' 8 | stderr = '' 9 | -------------------------------------------------------------------------------- /tests/succeed/implicit-args/insert-args.fathom: -------------------------------------------------------------------------------- 1 | let id = fun (@A : Type) (a : A) => a; 2 | let always = fun (@A : Type) (@B : Type) (a : A) (b : B) => a; 3 | 4 | let _ = id false; 5 | let _ = always (0 : U32) false; 6 | {} 7 | -------------------------------------------------------------------------------- /tests/succeed/implicit-args/insert-args.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | let id : fun (@A : Type) -> A -> A = fun @A a => a; 3 | let always : fun (@A : Type) (@B : Type) -> A -> B -> A = fun @A @B a b => a; 4 | let _ : Bool = id @Bool false; 5 | let _ : U32 = always @U32 @Bool 0 false; 6 | () : () 7 | ''' 8 | stderr = '' 9 | -------------------------------------------------------------------------------- /tests/succeed/implicit-args/specialize.fathom: -------------------------------------------------------------------------------- 1 | let id = fun (@A : Type) (a : A) => a; 2 | let always = fun (@A : Type) (@B : Type) (a : A) (b : B) => a; 3 | let apply = fun (@A : Type) (@B : Type) (f : A -> B) (x : A) => f x; 4 | 5 | // No specialization 6 | let _ = id; 7 | let _ = always; 8 | let _ = apply; 9 | 10 | // Full specialization 11 | let _ : Bool -> Bool = id; 12 | let _ : Bool -> U32 -> Bool = always; 13 | let _ : (Bool -> U32) -> Bool -> U32 = apply; 14 | 15 | // Specialization of higher order functions 16 | let _ = apply (always false) (0 : U32); 17 | 18 | {} 19 | -------------------------------------------------------------------------------- /tests/succeed/implicit-args/specialize.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | let id : fun (@A : Type) -> A -> A = fun @A a => a; 3 | let always : fun (@A : Type) (@B : Type) -> A -> B -> A = fun @A @B a b => a; 4 | let apply : fun (@A : Type) (@B : Type) -> (A -> B) -> A -> B = 5 | fun @A @B f x => f x; 6 | let _ : fun (@A : Type) -> A -> A = id; 7 | let _ : fun (@A : Type) (@B : Type) -> A -> B -> A = always; 8 | let _ : fun (@A : Type) (@B : Type) -> (A -> B) -> A -> B = apply; 9 | let _ : Bool -> Bool = id @Bool; 10 | let _ : Bool -> U32 -> Bool = always @Bool @U32; 11 | let _ : (Bool -> U32) -> Bool -> U32 = apply @Bool @U32; 12 | let _ : Bool = apply @U32 @Bool (always @Bool @U32 false) 0; 13 | () : () 14 | ''' 15 | stderr = '' 16 | -------------------------------------------------------------------------------- /tests/succeed/let/id-type.fathom: -------------------------------------------------------------------------------- 1 | let Id : Type -> Type 2 | = fun A => A; 3 | 4 | let test_id : fun (A : Type) -> Id A -> A 5 | = fun A => fun a => a; 6 | 7 | Type 8 | -------------------------------------------------------------------------------- /tests/succeed/let/id-type.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | let Id : Type -> Type = fun A => A; 3 | let test_id : fun (A : Type) -> Id A -> A = fun A a => a; 4 | Type : Type 5 | ''' 6 | stderr = '' 7 | -------------------------------------------------------------------------------- /tests/succeed/let/identity-placeholders.fathom: -------------------------------------------------------------------------------- 1 | let id : fun (A : _) -> A -> A 2 | = fun A => fun a => a; 3 | 4 | let test_id_check0 : Type -> Type = id _; 5 | let test_id_check1 : Type = id _ Type; 6 | 7 | let test_id_synth = id _ Type; 8 | 9 | Type 10 | -------------------------------------------------------------------------------- /tests/succeed/let/identity-placeholders.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | let id : fun (A : Type) -> A -> A = fun A a => a; 3 | let test_id_check0 : Type -> Type = id Type; 4 | let test_id_check1 : Type = id Type Type; 5 | let test_id_synth : Type = id Type Type; 6 | Type : Type 7 | ''' 8 | stderr = '' 9 | -------------------------------------------------------------------------------- /tests/succeed/let/identity.fathom: -------------------------------------------------------------------------------- 1 | let id : fun (A : Type) -> A -> A 2 | = fun A => fun a => a; 3 | 4 | let test_id_check0 : Type -> Type = id Type; 5 | let test_id_check1 : Type = id Type Type; 6 | 7 | let test_id_synth = id Type Type; 8 | 9 | Type 10 | -------------------------------------------------------------------------------- /tests/succeed/let/identity.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | let id : fun (A : Type) -> A -> A = fun A a => a; 3 | let test_id_check0 : Type -> Type = id Type; 4 | let test_id_check1 : Type = id Type Type; 5 | let test_id_synth : Type = id Type Type; 6 | Type : Type 7 | ''' 8 | stderr = '' 9 | -------------------------------------------------------------------------------- /tests/succeed/let/let-def-placeholder-ann.fathom: -------------------------------------------------------------------------------- 1 | let _ : Type = Type; 2 | 3 | Type 4 | -------------------------------------------------------------------------------- /tests/succeed/let/let-def-placeholder-ann.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | let _ : Type = Type; Type : Type 3 | ''' 4 | stderr = '' 5 | -------------------------------------------------------------------------------- /tests/succeed/let/let-def-placeholder.fathom: -------------------------------------------------------------------------------- 1 | let _ = Type; 2 | 3 | Type 4 | -------------------------------------------------------------------------------- /tests/succeed/let/let-def-placeholder.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | let _ : Type = Type; Type : Type 3 | ''' 4 | stderr = '' 5 | -------------------------------------------------------------------------------- /tests/succeed/match/check-const-1.fathom: -------------------------------------------------------------------------------- 1 | let x : U8 = 3; 2 | 3 | match x { 4 | 1 => 0, 5 | x => x, 6 | } : U8 7 | -------------------------------------------------------------------------------- /tests/succeed/match/check-const-1.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | let x : U8 = 3; match x { 1 => 0, x => x } : U8 3 | ''' 4 | stderr = '' 5 | -------------------------------------------------------------------------------- /tests/succeed/match/check-const-2.fathom: -------------------------------------------------------------------------------- 1 | let x : U8 = 3; 2 | 3 | match x { 4 | 1 => 0, 5 | 3 => 7, 6 | x => x, 7 | } : U8 8 | -------------------------------------------------------------------------------- /tests/succeed/match/check-const-2.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | let x : U8 = 3; match x { 1 => 0, 3 => 7, x => x } : U8 3 | ''' 4 | stderr = '' 5 | -------------------------------------------------------------------------------- /tests/succeed/match/check-const-bool.fathom: -------------------------------------------------------------------------------- 1 | let x : Bool = false; 2 | 3 | match x { 4 | false => 0, 5 | x => 1, 6 | } : U8 7 | -------------------------------------------------------------------------------- /tests/succeed/match/check-const-bool.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | let x : Bool = false; if x then 1 else 0 : U8 3 | ''' 4 | stderr = '' 5 | -------------------------------------------------------------------------------- /tests/succeed/match/check-const-redundant.fathom: -------------------------------------------------------------------------------- 1 | let x : U8 = 3; 2 | 3 | match x { 4 | 1 => 0, 5 | 3 => 7, 6 | x => x, 7 | 5 => 73, 8 | } : U8 9 | -------------------------------------------------------------------------------- /tests/succeed/match/check-const-redundant.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | let x : U8 = 3; match x { 1 => 0, 3 => 7, x => x } : U8 3 | ''' 4 | stderr = ''' 5 | warning: unreachable pattern 6 | ┌─ tests/succeed/match/check-const-redundant.fathom:7:5 7 | │ 8 | 7 │ 5 => 73, 9 | │ ^ 10 | 11 | ''' 12 | -------------------------------------------------------------------------------- /tests/succeed/match/check-simple-redundant.fathom: -------------------------------------------------------------------------------- 1 | match (3 : U8) { 2 | x => 3, 3 | y => 4, 4 | } : U32 5 | -------------------------------------------------------------------------------- /tests/succeed/match/check-simple-redundant.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | let x : U8 = 3; 3 : U32 3 | ''' 4 | stderr = ''' 5 | warning: unreachable pattern 6 | ┌─ tests/succeed/match/check-simple-redundant.fathom:3:5 7 | │ 8 | 3 │ y => 4, 9 | │ ^ 10 | 11 | ''' 12 | -------------------------------------------------------------------------------- /tests/succeed/match/check-simple.fathom: -------------------------------------------------------------------------------- 1 | match (3 : U8) { 2 | x => 3, 3 | } : U32 4 | -------------------------------------------------------------------------------- /tests/succeed/match/check-simple.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | let x : U8 = 3; 3 : U32 3 | ''' 4 | stderr = '' 5 | -------------------------------------------------------------------------------- /tests/succeed/match/synth-const-1.fathom: -------------------------------------------------------------------------------- 1 | let x : U8 = 3; 2 | 3 | match x { 4 | 1 => x, 5 | x => x, 6 | } 7 | -------------------------------------------------------------------------------- /tests/succeed/match/synth-const-1.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | let x : U8 = 3; match x { 1 => x, x => x } : U8 3 | ''' 4 | stderr = '' 5 | -------------------------------------------------------------------------------- /tests/succeed/match/synth-const-2.fathom: -------------------------------------------------------------------------------- 1 | let x : U8 = 3; 2 | 3 | match x { 4 | 1 => x, 5 | 3 => x, 6 | x => x, 7 | } 8 | -------------------------------------------------------------------------------- /tests/succeed/match/synth-const-2.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | let x : U8 = 3; match x { 1 => x, 3 => x, x => x } : U8 3 | ''' 4 | stderr = '' 5 | -------------------------------------------------------------------------------- /tests/succeed/match/synth-simple-redundant.fathom: -------------------------------------------------------------------------------- 1 | match (3 : U8) { 2 | x => x, 3 | y => 4, 4 | y => y, 5 | } 6 | -------------------------------------------------------------------------------- /tests/succeed/match/synth-simple-redundant.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | let x : U8 = 3; x : U8 3 | ''' 4 | stderr = ''' 5 | warning: unreachable pattern 6 | ┌─ tests/succeed/match/synth-simple-redundant.fathom:3:5 7 | │ 8 | 3 │ y => 4, 9 | │ ^ 10 | 11 | warning: unreachable pattern 12 | ┌─ tests/succeed/match/synth-simple-redundant.fathom:4:5 13 | │ 14 | 4 │ y => y, 15 | │ ^ 16 | 17 | ''' 18 | -------------------------------------------------------------------------------- /tests/succeed/match/synth-simple.fathom: -------------------------------------------------------------------------------- 1 | match (3 : U8) { 2 | x => x, 3 | } 4 | -------------------------------------------------------------------------------- /tests/succeed/match/synth-simple.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | let x : U8 = 3; x : U8 3 | ''' 4 | stderr = '' 5 | -------------------------------------------------------------------------------- /tests/succeed/numeric-literal/binary.fathom: -------------------------------------------------------------------------------- 1 | 0b11110000 : U8 2 | -------------------------------------------------------------------------------- /tests/succeed/numeric-literal/binary.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | 0b11110000 : U8 3 | ''' 4 | stderr = '' 5 | -------------------------------------------------------------------------------- /tests/succeed/numeric-literal/hexadecimal.fathom: -------------------------------------------------------------------------------- 1 | 0xCAFE : U32 2 | -------------------------------------------------------------------------------- /tests/succeed/numeric-literal/hexadecimal.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | 0xcafe : U32 3 | ''' 4 | stderr = '' 5 | -------------------------------------------------------------------------------- /tests/succeed/numeric-literal/signed.fathom: -------------------------------------------------------------------------------- 1 | -123 : S32 2 | -------------------------------------------------------------------------------- /tests/succeed/numeric-literal/signed.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | -123 : S32 3 | ''' 4 | stderr = '' 5 | -------------------------------------------------------------------------------- /tests/succeed/numeric-literal/style-conflict.fathom: -------------------------------------------------------------------------------- 1 | //~ test-normalization = true 2 | 3 | u32_add "nope" 0xcafe 4 | -------------------------------------------------------------------------------- /tests/succeed/numeric-literal/style-conflict.norm.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | 1852848995 : U32 3 | ''' 4 | stderr = '' 5 | -------------------------------------------------------------------------------- /tests/succeed/numeric-literal/style-conflict.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | ("nope" : U32) + (0xcafe : U32) : U32 3 | ''' 4 | stderr = '' 5 | -------------------------------------------------------------------------------- /tests/succeed/numeric-literal/style-preserve-binary.fathom: -------------------------------------------------------------------------------- 1 | //~ test-normalization = true 2 | 3 | u8_shl 0b00000001 4 4 | -------------------------------------------------------------------------------- /tests/succeed/numeric-literal/style-preserve-binary.norm.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | 0b10000 : U8 3 | ''' 4 | stderr = '' 5 | -------------------------------------------------------------------------------- /tests/succeed/numeric-literal/style-preserve-binary.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | u8_shl 0b1 4 : U8 3 | ''' 4 | stderr = '' 5 | -------------------------------------------------------------------------------- /tests/succeed/numeric-literal/style-propagate-binary.fathom: -------------------------------------------------------------------------------- 1 | //~ test-normalization = true 2 | 3 | u8_add 0b1 2 4 | -------------------------------------------------------------------------------- /tests/succeed/numeric-literal/style-propagate-binary.norm.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | 0b11 : U8 3 | ''' 4 | stderr = '' 5 | -------------------------------------------------------------------------------- /tests/succeed/numeric-literal/style-propagate-binary.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | (0b1 : U8) + (2 : U8) : U8 3 | ''' 4 | stderr = '' 5 | -------------------------------------------------------------------------------- /tests/succeed/numeric-literal/style-propagate-hex.fathom: -------------------------------------------------------------------------------- 1 | //~ test-normalization = true 2 | 3 | u8_add 0x2 1 4 | -------------------------------------------------------------------------------- /tests/succeed/numeric-literal/style-propagate-hex.norm.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | 0x3 : U8 3 | ''' 4 | stderr = '' 5 | -------------------------------------------------------------------------------- /tests/succeed/numeric-literal/style-propagate-hex.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | (0x2 : U8) + (1 : U8) : U8 3 | ''' 4 | stderr = '' 5 | -------------------------------------------------------------------------------- /tests/succeed/numeric-literal/styled.fathom: -------------------------------------------------------------------------------- 1 | let x : U32 = 4660; 2 | let _ : U16 = match x { 0x1234 => 0b1, 0b1111 => 0b10, "head" => 0b100, _ => 0xFFFF }; 3 | 4 | let beef: U16 = 0xbeef; 5 | 6 | Void 7 | -------------------------------------------------------------------------------- /tests/succeed/numeric-literal/styled.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | let x : U32 = 4660; 3 | let _ : U16 = match x { 4 | 0b1111 => 0b10, 5 | 0x1234 => 0b1, 6 | "head" => 0b100, 7 | _ => 0xffff, 8 | }; 9 | let beef : U16 = 0xbeef; 10 | Void : Type 11 | ''' 12 | stderr = '' 13 | -------------------------------------------------------------------------------- /tests/succeed/primitive-ops.fathom: -------------------------------------------------------------------------------- 1 | let test : Array8 (u8_add 1 2) {} -> Array8 3 {} = fun x => x; 2 | let test : Array16 (u16_add 1 2) {} -> Array16 3 {} = fun x => x; 3 | let test : Array32 (u32_add 1 2) {} -> Array32 3 {} = fun x => x; 4 | let test : Array64 (u64_add 1 2) {} -> Array64 3 {} = fun x => x; 5 | 6 | let test : Array8 (u8_sub 3 1) {} -> Array8 2 {} = fun x => x; 7 | let test : Array16 (u16_sub 3 1) {} -> Array16 2 {} = fun x => x; 8 | let test : Array32 (u32_sub 3 1) {} -> Array32 2 {} = fun x => x; 9 | let test : Array64 (u64_sub 3 1) {} -> Array64 2 {} = fun x => x; 10 | 11 | Type 12 | -------------------------------------------------------------------------------- /tests/succeed/primitive-ops.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | let test : Array8 ((1 : U8) + (2 : U8)) () -> Array8 3 () = fun x => x; 3 | let test : Array16 ((1 : U16) + (2 : U16)) () -> Array16 3 () = fun x => x; 4 | let test : Array32 ((1 : U32) + (2 : U32)) () -> Array32 3 () = fun x => x; 5 | let test : Array64 ((1 : U64) + (2 : U64)) () -> Array64 3 () = fun x => x; 6 | let test : Array8 ((3 : U8) - (1 : U8)) () -> Array8 2 () = fun x => x; 7 | let test : Array16 ((3 : U16) - (1 : U16)) () -> Array16 2 () = fun x => x; 8 | let test : Array32 ((3 : U32) - (1 : U32)) () -> Array32 2 () = fun x => x; 9 | let test : Array64 ((3 : U64) - (1 : U64)) () -> Array64 2 () = fun x => x; 10 | Type : Type 11 | ''' 12 | stderr = '' 13 | -------------------------------------------------------------------------------- /tests/succeed/raw-identifiers.fathom: -------------------------------------------------------------------------------- 1 | let r#def = false; 2 | let r#foo = r#def; 3 | foo 4 | -------------------------------------------------------------------------------- /tests/succeed/raw-identifiers.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | let r#def : Bool = false; let foo : Bool = r#def; foo : Bool 3 | ''' 4 | stderr = '' 5 | -------------------------------------------------------------------------------- /tests/succeed/record-elim/singleton.fathom: -------------------------------------------------------------------------------- 1 | { test = {} }.test 2 | -------------------------------------------------------------------------------- /tests/succeed/record-elim/singleton.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | { test = () }.test : () 3 | ''' 4 | stderr = '' 5 | -------------------------------------------------------------------------------- /tests/succeed/record-field-shorthand.fathom: -------------------------------------------------------------------------------- 1 | let x = (1 : U32); 2 | let y = (2 : U32); 3 | let z = (3 : U32); 4 | 5 | let _ = {x, y, z}; 6 | let _ = {x = x, y = y, z = z}; 7 | {} 8 | -------------------------------------------------------------------------------- /tests/succeed/record-field-shorthand.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | let x : U32 = 1; 3 | let y : U32 = 2; 4 | let z : U32 = 3; 5 | let _ : { x : U32, y : U32, z : U32 } = { x, y, z }; 6 | let _ : { x : U32, y : U32, z : U32 } = { x, y, z }; 7 | () : () 8 | ''' 9 | stderr = '' 10 | -------------------------------------------------------------------------------- /tests/succeed/record-type/generic-pair.fathom: -------------------------------------------------------------------------------- 1 | let fst = fun (A: Type) (B: Type) (p: {x: A, y: B}) => p.x; 2 | let snd = fun (A: Type) (B: Type) (p: {x: A, y: B}) => p.y; 3 | {} -------------------------------------------------------------------------------- /tests/succeed/record-type/generic-pair.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | let fst : fun (A : Type) (B : Type) -> { x : A, y : B } -> A = fun A B p => p.x; 3 | let snd : fun (A : Type) (B : Type) -> { x : A, y : B } -> B = fun A B p => p.y; 4 | () : () 5 | ''' 6 | stderr = '' 7 | -------------------------------------------------------------------------------- /tests/succeed/record-type/generic-point.fathom: -------------------------------------------------------------------------------- 1 | let Point : Type -> Type 2 | = fun A => { x : A, y : A }; 3 | 4 | let test_point : fun (A : Type) -> Point A -> { x : A, y : A } 5 | = fun A => fun p => p; 6 | 7 | Type 8 | -------------------------------------------------------------------------------- /tests/succeed/record-type/generic-point.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | let Point : Type -> Type = fun A => { x : A, y : A }; 3 | let test_point : fun (A : Type) -> Point A -> { x : A, y : A } = fun A p => p; 4 | Type : Type 5 | ''' 6 | stderr = '' 7 | -------------------------------------------------------------------------------- /tests/succeed/record-type/generic-singleton.fathom: -------------------------------------------------------------------------------- 1 | let Singleton : Type -> Type 2 | = fun A => { x : A }; 3 | 4 | let test_point : fun (A : Type) -> Singleton A -> { x : A } 5 | = fun A => fun p => p; 6 | 7 | Type 8 | -------------------------------------------------------------------------------- /tests/succeed/record-type/generic-singleton.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | let Singleton : Type -> Type = fun A => { x : A }; 3 | let test_point : fun (A : Type) -> Singleton A -> { x : A } = fun A p => p; 4 | Type : Type 5 | ''' 6 | stderr = '' 7 | -------------------------------------------------------------------------------- /tests/succeed/record-type/generic-triple.fathom: -------------------------------------------------------------------------------- 1 | let get1 = fun (A: Type) (B: Type) (C: Type) (p: {x: A, y: B, z: C}) => p.x; 2 | let get2 = fun (A: Type) (B: Type) (C: Type) (p: {x: A, y: B, z: C}) => p.y; 3 | let get3 = fun (A: Type) (B: Type) (C: Type) (p: {x: A, y: B, z: C}) => p.z; 4 | {} -------------------------------------------------------------------------------- /tests/succeed/record-type/generic-triple.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | let get1 : fun (A : Type) (B : Type) (C : Type) -> { x : A, y : B, z : C } -> 3 | A = fun A B C p => p.x; 4 | let get2 : fun (A : Type) (B : Type) (C : Type) -> { x : A, y : B, z : C } -> 5 | B = fun A B C p => p.y; 6 | let get3 : fun (A : Type) (B : Type) (C : Type) -> { x : A, y : B, z : C } -> 7 | C = fun A B C p => p.z; 8 | () : () 9 | ''' 10 | stderr = '' 11 | -------------------------------------------------------------------------------- /tests/succeed/record-type/pair-dependent.fathom: -------------------------------------------------------------------------------- 1 | { 2 | A : Type, 3 | a : A, 4 | } 5 | -------------------------------------------------------------------------------- /tests/succeed/record-type/pair-dependent.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | { A : Type, a : A } : Type 3 | ''' 4 | stderr = '' 5 | -------------------------------------------------------------------------------- /tests/succeed/record-type/pair.fathom: -------------------------------------------------------------------------------- 1 | { first : Type, second : Type } 2 | -------------------------------------------------------------------------------- /tests/succeed/record-type/pair.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | { first : Type, second : Type } : Type 3 | ''' 4 | stderr = '' 5 | -------------------------------------------------------------------------------- /tests/succeed/record-type/singleton.fathom: -------------------------------------------------------------------------------- 1 | { data : Type } 2 | -------------------------------------------------------------------------------- /tests/succeed/record-type/singleton.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | { data : Type } : Type 3 | ''' 4 | stderr = '' 5 | -------------------------------------------------------------------------------- /tests/succeed/tuple/check-format.fathom: -------------------------------------------------------------------------------- 1 | let Unit: Format = (); 2 | let Paren: Format = (u8); // A parenthesised expression, NOT a 1-element tuple! 3 | let Single: Format = (u8,); 4 | let Pair: Format = (u8, u8); 5 | let Triple: Format = (u8, u8, u8); 6 | 7 | Unit 8 | -------------------------------------------------------------------------------- /tests/succeed/tuple/check-format.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | let Unit : Format = (); 3 | let Paren : Format = u8; 4 | let Single : Format = (u8,); 5 | let Pair : Format = (u8, u8); 6 | let Triple : Format = (u8, u8, u8); 7 | Unit : Format 8 | ''' 9 | stderr = '' 10 | -------------------------------------------------------------------------------- /tests/succeed/tuple/check-term.fathom: -------------------------------------------------------------------------------- 1 | let Triple: Type = (U16, U16, U16); 2 | let Point: Type = {x: U16, y: U16, z: U16}; 3 | let Any: Type = {A: Type, a: A}; 4 | 5 | let triple: Triple = (0, 1, 2); 6 | let point: Point = (0, 1, 2); 7 | let any: Any = (Bool, false); 8 | 9 | () 10 | -------------------------------------------------------------------------------- /tests/succeed/tuple/check-term.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | let Triple : Type = (U16, U16, U16); 3 | let Point : Type = { x : U16, y : U16, z : U16 }; 4 | let Any : Type = { A : Type, a : A }; 5 | let triple : Triple = (0, 1, 2); 6 | let point : Point = { x = 0, y = 1, z = 2 }; 7 | let any : Any = { A = Bool, a = false }; 8 | () : () 9 | ''' 10 | stderr = '' 11 | -------------------------------------------------------------------------------- /tests/succeed/tuple/check-universe.fathom: -------------------------------------------------------------------------------- 1 | let Unit: Type = (); 2 | let Paren: Type = (Bool); // A parenthesised expression, NOT a 1-element tuple! 3 | let Single: Type = (Bool,); 4 | let Pair: Type = (Bool, U8); 5 | let Triple: Type = (Bool, U8, U16); 6 | 7 | Unit 8 | -------------------------------------------------------------------------------- /tests/succeed/tuple/check-universe.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | let Unit : Type = (); 3 | let Paren : Type = Bool; 4 | let Single : Type = (Bool,); 5 | let Pair : Type = (Bool, U8); 6 | let Triple : Type = (Bool, U8, U16); 7 | Unit : Type 8 | ''' 9 | stderr = '' 10 | -------------------------------------------------------------------------------- /tests/succeed/tuple/generic-pair.fathom: -------------------------------------------------------------------------------- 1 | let fst = fun (A: Type) (B: Type) (p: {_0: A, _1: B}) => p._0; 2 | let snd = fun (A: Type) (B: Type) (p: (A, B)) => p._1; 3 | {} 4 | -------------------------------------------------------------------------------- /tests/succeed/tuple/generic-pair.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | let fst : fun (A : Type) (B : Type) -> (A, B) -> A = fun A B p => p._0; 3 | let snd : fun (A : Type) (B : Type) -> (A, B) -> B = fun A B p => p._1; 4 | () : () 5 | ''' 6 | stderr = '' 7 | -------------------------------------------------------------------------------- /tests/succeed/tuple/generic-triple.fathom: -------------------------------------------------------------------------------- 1 | let get1 = fun (A: Type) (B: Type) (C: Type) (p: {_0: A, _1: B, _2: C}) => p._0; 2 | let get2 = fun (A: Type) (B: Type) (C: Type) (p: (A, B, C)) => p._1; 3 | let get3 = fun (A: Type) (B: Type) (C: Type) (p: (A, B, C)) => p._2; 4 | {} 5 | -------------------------------------------------------------------------------- /tests/succeed/tuple/generic-triple.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | let get1 : fun (A : Type) (B : Type) (C : Type) -> (A, B, C) -> A = 3 | fun A B C p => p._0; 4 | let get2 : fun (A : Type) (B : Type) (C : Type) -> (A, B, C) -> B = 5 | fun A B C p => p._1; 6 | let get3 : fun (A : Type) (B : Type) (C : Type) -> (A, B, C) -> C = 7 | fun A B C p => p._2; 8 | () : () 9 | ''' 10 | stderr = '' 11 | -------------------------------------------------------------------------------- /tests/succeed/tuple/synth.fathom: -------------------------------------------------------------------------------- 1 | let unit = (); 2 | let paren = (false); // A parenthesised expression, NOT a 1-element tuple! 3 | let single = (false,); 4 | let pair = (false, true); 5 | let triple = (false, true, false); 6 | 7 | () 8 | -------------------------------------------------------------------------------- /tests/succeed/tuple/synth.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | let unit : () = (); 3 | let paren : Bool = false; 4 | let single : (Bool,) = (false,); 5 | let pair : (Bool, Bool) = (false, true); 6 | let triple : (Bool, Bool, Bool) = (false, true, false); 7 | () : () 8 | ''' 9 | stderr = '' 10 | -------------------------------------------------------------------------------- /tests/succeed/type.fathom: -------------------------------------------------------------------------------- 1 | Type 2 | -------------------------------------------------------------------------------- /tests/succeed/type.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | Type : Type 3 | ''' 4 | stderr = '' 5 | -------------------------------------------------------------------------------- /tests/succeed/unit-literal.fathom: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /tests/succeed/unit-literal.snap: -------------------------------------------------------------------------------- 1 | stdout = ''' 2 | () : () 3 | ''' 4 | stderr = '' 5 | -------------------------------------------------------------------------------- /yarn.lock: -------------------------------------------------------------------------------- 1 | # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. 2 | # yarn lockfile v1 3 | 4 | 5 | makam@^0.7.36: 6 | version "0.7.37" 7 | resolved "https://registry.yarnpkg.com/makam/-/makam-0.7.37.tgz#201f773a888fe2a1d64c37ae23241dd708ccc00b" 8 | integrity sha512-6DGx7FnmgAf+dYXrptwmgC6WDR0+emgM1jMscY/3yitXP3IYq0BvFE2UKq66P16nkHcQHmENK6xTt8M3Z+rdBw== 9 | --------------------------------------------------------------------------------