feat(grfn/achilles): Implement tuples, and tuple patterns

Implement tuple expressions, types, and patterns, all the way through
the parser down to the typechecker. In LLVM, these are implemented as
anonymous structs, using an `extract` instruction when they're pattern
matched on to get out the individual fields.

Currently the only limitation here is patterns aren't supported in
function argument position, but you can still do something like

    fn xy = let (x, y) = xy in x + y

Change-Id: I357f17e9d4052e741eda8605b6662822f331efde
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3027
Reviewed-by: grfn <grfn@gws.fyi>
Tested-by: BuildkiteCI
This commit is contained in:
Griffin Smith 2021-04-17 08:28:24 +02:00 committed by grfn
parent e1c45be3f5
commit 48098f83c1
12 changed files with 413 additions and 54 deletions

View file

@ -6,6 +6,7 @@ use nom::{alt, char, complete, do_parse, eof, many0, named, separated_list0, tag
pub(crate) mod macros;
mod expr;
mod type_;
mod util;
use crate::ast::{Arg, Decl, Fun, Ident};
pub use expr::expr;