From 8e9b410e02c8203a3579a37bca638951b5dc47b7 Mon Sep 17 00:00:00 2001 From: greg Date: Wed, 20 Mar 2019 01:15:35 -0700 Subject: [PATCH] Clean up TODO list --- TODO.md | 155 ++++++++++++++++++++------------------------------------ 1 file changed, 54 insertions(+), 101 deletions(-) diff --git a/TODO.md b/TODO.md index c2204dc..407456a 100644 --- a/TODO.md +++ b/TODO.md @@ -1,65 +1,68 @@ -#Typechecking Notes +# TODO items +## Typechecking -IDEA: - if you have a pattern-match where one variant has a variable and the other lacks it +- cf. the notation mentioned in the cardelli paper, the debug information for the `typechecking` pass should +print the generated type variable for every subexpression in an expression + +- change 'trait' to 'interface' + +- think about idris-related ideas of multiple implementations of a type for an interface (+ vs * impl for monoids, for preorder/inorder/postorder for Foldable) + +-should have an Idris-like `cast To From` function + +## Schala-lang syntax + +- Idea: if you have a pattern-match where one variant has a variable and the other lacks it instead of treating this as a type error, promote the bound variable to an option type +- Include extensible scala-style html"string ${var}" string interpolations -IS BOX SYNTAX READY???? - -(cf. cardelli paper) - -Given a length function def: -```` -fn length(x) { - if x.is_null { - 0 - } else { - succ(length(x.tail)) - } -} -```` -Constraints: -.null: List a -> bool -.tail: List a -> List a -0: Nat -succ: Nat -> Nat - - - - -# TODO Items - --make the REPL more advanced! - --Plan of attack: - -write a visitor pattern for AST - -convert AST type to including SourceMap'd wrappers (w/ .into()) - -at the same time, amke sure the visitor pattern "skips over" the SourceMap'd stuff - so it can just care about AST structure - -- AST : maybe replace the Expression type with "Ascription(TypeName, Box) nodes?? -- parser: add a "debug" field to the Parser struct for all debug-related things - --scala-style html"dfasfsadf${}" string interpolations! - --fuzz test schala - --look into Inkwell for LLVM - - -*A neat idea for pattern matching optimization would be if you could match on one of several things in a list +- A neat idea for pattern matching optimization would be if you could match on one of several things in a list ex: -if x { +```if x { is (comp, LHSPat, RHSPat) if comp in ["==, "<"] -> ... -} +}``` +- Schala should have both currying *and* default arguments! +```fn a(b: Int, c:Int, d:Int = 1) -> Int + a(1,2) : Int + a(1,2,d=2): Int + a(_,1,3) : Int -> Int + a(1,2, c=_): Int -> Int + a(_,_,_) : Int -> Int -> Int -> Int +``` + +- scoped types - be able to define a quick enum type scoped to a function or other type for + something, that only is meant to be used as a quick bespoke interface between + two other things + +ex. +```type enum { + type enum MySubVariant { + SubVariant1, SubVariant2, etc. + } + Variant1(MySubVariant), + Variant2(...), + }``` + +- inclusive/exclusive range syntax like .. vs ..= + +## Compilation +-look into Inkwell for rust LLVM bindings -- https://nshipster.com/never/ -https://cranelift.readthedocs.io/en/latest/?badge=latest + +## Other links of note + +- https://nshipster.com/never/ -consult http://gluon-lang.org/book/embedding-api.html + + +## Playing around with conditional syntax ideas + - if/match playground simple if @@ -101,64 +104,14 @@ can replace `'if' discriminator '{' 'true' 'then' block_or_expr; 'false' 'then' -- Next priorities: - get ADTs working, get matches working - -- inclusive/exclusive range syntax like .. vs ..= - -- sketch of an idea for the REPL: - -each compiler pass should be a (procedural?) macro like - compiler_pass!("parse", dataproducts: ["ast", "parse_tree"], { - match parsing::parse(INPUT) { - Ok( - PASS.add_artifact( - } - --should have an Idris-like `cast To From` function - -- REPL: - - want to be able to do things like `:doc Identifier`, and have the language load up these definitions to the REPL - - -* change 'trait' to 'interface' - -think about idris-related ideas of multiple implementations of a type for an interface (+ vs * impl for monoids, for preorder/inorder/postorder for Foldable) - -* Share state between programming languages - -* idea for Schala - scoped types - be able to define a quick enum type scoped to a function ro something, that only is meant to be used as a quick bespoke interface between two other things - -* another idea, allow: -type enum { - type enum MySubVariant { - SubVariant1, SubVariant2, etc. - } - Variant1(MySubVariant), - Variant2(...), - } - - - -* idea for Schala: both currying *and* default arguments! - ex. fn a(b: Int, c:Int, d:Int = 1) -> Int - a(1,2) : Int - a(1,2,d=2): Int - a(_,1,3) : Int -> Int - a(1,2, c=_): Int -> Int - a(_,_,_) : Int -> Int -> Int -> Int -*Compiler passes architecture* --ProgrammingLanguageInterface defines a evaluate_in_repl() and evaluate_no_repl() functions --these take in a vec of CompilerPasses -struct CompilerPass { - name: String, - run: fn(PrevPass) -> NextPass -} --change "Type...." names in parser.rs to "Anno..." for non-collision with names in typechecking.rs --get rid of code pertaining to compilation specifically, have a more generation notion of "execution type" + +