scheme.git
4 years agoFix total pattern match verification master
Luke Lau [Sat, 17 Aug 2019 18:53:14 +0000 (19:53 +0100)]
Fix total pattern match verification

4 years agoStore ADTs with only singletons in registers
Luke Lau [Sat, 17 Aug 2019 18:43:44 +0000 (19:43 +0100)]
Store ADTs with only singletons in registers

Also define Bool as an ADT within the stdlib!

4 years agoCheck for complete pattern matches
Luke Lau [Fri, 16 Aug 2019 15:06:44 +0000 (16:06 +0100)]
Check for complete pattern matches

4 years agoAdd extra spicy test case
Luke Lau [Fri, 16 Aug 2019 00:19:00 +0000 (01:19 +0100)]
Add extra spicy test case

4 years agoFix typechecking with bindings
Luke Lau [Fri, 16 Aug 2019 00:12:54 +0000 (01:12 +0100)]
Fix typechecking with bindings

4 years agoStart work on collecting all bindings when typechecking nested pattern match
Luke Lau [Thu, 15 Aug 2019 16:36:32 +0000 (17:36 +0100)]
Start work on collecting all bindings when typechecking nested pattern match

4 years agoAdd more complicated pattern matching test case
Luke Lau [Thu, 15 Aug 2019 16:24:09 +0000 (17:24 +0100)]
Add more complicated pattern matching test case

4 years agoFix bindings in ADT pattern matching codegen
Luke Lau [Thu, 15 Aug 2019 16:21:13 +0000 (17:21 +0100)]
Fix bindings in ADT pattern matching codegen

4 years agoAdd case statement codegen and singleton ADTs
Luke Lau [Thu, 15 Aug 2019 15:51:36 +0000 (16:51 +0100)]
Add case statement codegen and singleton ADTs

4 years agoHandle pattern matching entire expressions
Luke Lau [Thu, 15 Aug 2019 12:45:53 +0000 (13:45 +0100)]
Handle pattern matching entire expressions

4 years agoAdd bindings to pattern matching in case statement typechecking
Luke Lau [Thu, 15 Aug 2019 11:14:35 +0000 (12:14 +0100)]
Add bindings to pattern matching in case statement typechecking

4 years agoFix up typechecking of case
Luke Lau [Thu, 15 Aug 2019 09:47:27 +0000 (10:47 +0100)]
Fix up typechecking of case

4 years agoWIP on typechecking case statements
Luke Lau [Thu, 15 Aug 2019 00:12:31 +0000 (01:12 +0100)]
WIP on typechecking case statements

4 years agoStart work on case statements
Luke Lau [Wed, 14 Aug 2019 15:08:31 +0000 (16:08 +0100)]
Start work on case statements

4 years agoFlesh out stack values within ADTs
Luke Lau [Wed, 14 Aug 2019 14:52:32 +0000 (15:52 +0100)]
Flesh out stack values within ADTs

4 years agoFix typo
Luke Lau [Wed, 14 Aug 2019 14:38:56 +0000 (15:38 +0100)]
Fix typo

4 years agoFix typo
Luke Lau [Wed, 14 Aug 2019 13:12:09 +0000 (14:12 +0100)]
Fix typo

4 years agoCan now pass about adts stored on the stack
Luke Lau [Wed, 14 Aug 2019 13:09:54 +0000 (14:09 +0100)]
Can now pass about adts stored on the stack

4 years agoMove utils into its onw file
Luke Lau [Tue, 13 Aug 2019 15:06:28 +0000 (16:06 +0100)]
Move utils into its onw file

4 years agoCheck for let pattern matches that they have only one sum
Luke Lau [Tue, 13 Aug 2019 13:09:45 +0000 (14:09 +0100)]
Check for let pattern matches that they have only one sum

4 years agoUpdate main.scm to properly read in multi-expression programs
Luke Lau [Tue, 13 Aug 2019 13:03:53 +0000 (14:03 +0100)]
Update main.scm to properly read in multi-expression programs

4 years agoCheck for the right number of bindings in pattern matching
Luke Lau [Tue, 13 Aug 2019 10:21:41 +0000 (11:21 +0100)]
Check for the right number of bindings in pattern matching

4 years agoMove expanding pattern matches to its own transformations
Luke Lau [Mon, 12 Aug 2019 15:26:21 +0000 (16:26 +0100)]
Move expanding pattern matches to its own transformations

I think this will make it easier to understand how pattern matching
works

4 years agoADT codegen working for simple types
Luke Lau [Mon, 12 Aug 2019 12:54:44 +0000 (13:54 +0100)]
ADT codegen working for simple types

4 years agoA bit more work on ADT codegen
Luke Lau [Tue, 6 Aug 2019 15:06:29 +0000 (16:06 +0100)]
A bit more work on ADT codegen

4 years agoDenormalize the type annotated ast, and tag stack values
Luke Lau [Tue, 6 Aug 2019 14:27:58 +0000 (15:27 +0100)]
Denormalize the type annotated ast, and tag stack values

4 years agoAnnotate ast with types for adt codegen
Luke Lau [Tue, 6 Aug 2019 06:58:11 +0000 (07:58 +0100)]
Annotate ast with types for adt codegen

4 years agoFormulate destructors properly
Luke Lau [Sun, 4 Aug 2019 20:22:57 +0000 (21:22 +0100)]
Formulate destructors properly

4 years agoFix let-bindings
Luke Lau [Sun, 4 Aug 2019 18:23:09 +0000 (19:23 +0100)]
Fix let-bindings

4 years agoFix flat-map
Luke Lau [Sun, 4 Aug 2019 18:09:40 +0000 (19:09 +0100)]
Fix flat-map

4 years agoMerge branch 'master' of lukelau.me:/srv/git/scheme
Luke Lau [Sun, 4 Aug 2019 18:04:36 +0000 (19:04 +0100)]
Merge branch 'master' of lukelau.me:/srv/git/scheme

4 years agoAdd test case
Luke Lau [Sun, 4 Aug 2019 18:04:27 +0000 (19:04 +0100)]
Add test case

4 years agoRemove redundant range definition
Luke Lau [Fri, 2 Aug 2019 15:09:07 +0000 (16:09 +0100)]
Remove redundant range definition

4 years agoWIP in let-binding pattern match stuff
Luke Lau [Fri, 2 Aug 2019 15:08:37 +0000 (16:08 +0100)]
WIP in let-binding pattern match stuff

4 years agoStart work on ADTs
Luke Lau [Fri, 2 Aug 2019 14:45:26 +0000 (15:45 +0100)]
Start work on ADTs

4 years agoTidy up
Luke Lau [Fri, 2 Aug 2019 09:27:16 +0000 (10:27 +0100)]
Tidy up

4 years agoAdd clash constraints when merging typechecker-refactor
Luke Lau [Thu, 1 Aug 2019 15:35:05 +0000 (16:35 +0100)]
Add clash constraints when merging

4 years agoWIP on typechecker refactor
Luke Lau [Thu, 1 Aug 2019 15:19:56 +0000 (16:19 +0100)]
WIP on typechecker refactor

Need to figure out the best way to union merge constraints, where they
have the same key but one has a more concrete term

4 years agoFix starting off with the wrong stack index
Luke Lau [Tue, 30 Jul 2019 22:57:23 +0000 (23:57 +0100)]
Fix starting off with the wrong stack index

And thus fix botched backtraces

4 years agoMake base pointer to point to the previous frames base pointer
Luke Lau [Tue, 30 Jul 2019 22:26:41 +0000 (23:26 +0100)]
Make base pointer to point to the previous frames base pointer

Backtrace still looks kinda funny in lldb

4 years agoAdd notes on typechecking
Luke Lau [Tue, 30 Jul 2019 21:25:31 +0000 (22:25 +0100)]
Add notes on typechecking

4 years agoMerge branch 'master' of lukelau.me:/srv/git/scheme
Luke Lau [Tue, 30 Jul 2019 21:25:15 +0000 (22:25 +0100)]
Merge branch 'master' of lukelau.me:/srv/git/scheme

4 years agoAdd support for recursive let binding codegen
Luke Lau [Tue, 30 Jul 2019 21:24:41 +0000 (22:24 +0100)]
Add support for recursive let binding codegen

4 years agoAdd notes on ownership
Luke Lau [Tue, 30 Jul 2019 16:14:56 +0000 (17:14 +0100)]
Add notes on ownership

4 years agoAdd pow test
Luke Lau [Tue, 30 Jul 2019 00:06:10 +0000 (01:06 +0100)]
Add pow test

4 years agoAdd a test for equality
Luke Lau [Mon, 29 Jul 2019 23:49:40 +0000 (00:49 +0100)]
Add a test for equality

4 years agoReset label and lambda counters on compile
Luke Lau [Mon, 29 Jul 2019 23:49:14 +0000 (00:49 +0100)]
Reset label and lambda counters on compile

Also emit some comments in the assembly for debugging

4 years agoFix = codegen
Luke Lau [Mon, 29 Jul 2019 23:48:00 +0000 (00:48 +0100)]
Fix = codegen

Use the sete instruction instead of the just plain wrong subtraction
method

4 years agoFix graph not considering original binds when recursing
Luke Lau [Mon, 29 Jul 2019 13:20:47 +0000 (14:20 +0100)]
Fix graph not considering original binds when recursing

4 years agoUpdate recursive test to simpler example
Luke Lau [Mon, 29 Jul 2019 13:00:00 +0000 (14:00 +0100)]
Update recursive test to simpler example

4 years agoSubstitute constraints after recursive call
Luke Lau [Mon, 29 Jul 2019 12:55:23 +0000 (13:55 +0100)]
Substitute constraints after recursive call

Now it typechecks! Also fix type-equal? being too lenient

4 years agoAdd ast-find
Luke Lau [Mon, 29 Jul 2019 12:44:23 +0000 (13:44 +0100)]
Add ast-find

4 years agoRefactor unify
Luke Lau [Mon, 29 Jul 2019 12:27:38 +0000 (13:27 +0100)]
Refactor unify

4 years agoAlways use PIC for static string codegen
Luke Lau [Mon, 29 Jul 2019 12:18:11 +0000 (13:18 +0100)]
Always use PIC for static string codegen

4 years agoStart thinking about heap allocation
Luke Lau [Mon, 29 Jul 2019 09:20:58 +0000 (10:20 +0100)]
Start thinking about heap allocation

4 years agoAdd dodgy uname based host OS detection
Luke Lau [Mon, 29 Jul 2019 09:08:47 +0000 (10:08 +0100)]
Add dodgy uname based host OS detection

4 years agoSubstitute only the variables in the scc
Luke Lau [Sun, 28 Jul 2019 23:40:30 +0000 (00:40 +0100)]
Substitute only the variables in the scc

This preserves the most generic possible type

Also add a test for type equality (unifies, but only type variable
substitutions)
Fix graph when there's no bindings

4 years agoBreak up lets into SCCs before typechecking
Luke Lau [Sun, 28 Jul 2019 22:56:37 +0000 (23:56 +0100)]
Break up lets into SCCs before typechecking

This means each binding gets the most general type possible.
Part of the work towards supporting typechecking recursive functions

4 years agoAdd some documentation to the abi
Luke Lau [Sun, 28 Jul 2019 12:07:00 +0000 (13:07 +0100)]
Add some documentation to the abi

4 years agoAdd a bunch more tests
Luke Lau [Sat, 27 Jul 2019 23:04:49 +0000 (00:04 +0100)]
Add a bunch more tests

4 years agoFill in missing builtin lambda info
Luke Lau [Sat, 27 Jul 2019 23:04:36 +0000 (00:04 +0100)]
Fill in missing builtin lambda info

4 years agoFix overwriting preserved base pointer in prolog
Luke Lau [Sat, 27 Jul 2019 22:54:16 +0000 (23:54 +0100)]
Fix overwriting preserved base pointer in prolog

Also fix illegal instruction copying over captives

4 years agoAdd new test
Luke Lau [Sat, 27 Jul 2019 22:53:51 +0000 (23:53 +0100)]
Add new test

4 years agoAllocate and pass closures on the heap
Luke Lau [Sat, 27 Jul 2019 22:18:01 +0000 (23:18 +0100)]
Allocate and pass closures on the heap

4 years agoMerge branch 'master' of lukelau.me:/srv/git/scheme
Luke Lau [Wed, 24 Jul 2019 23:59:30 +0000 (00:59 +0100)]
Merge branch 'master' of lukelau.me:/srv/git/scheme

4 years agoMore WIP on closures
Luke Lau [Wed, 24 Jul 2019 15:36:58 +0000 (16:36 +0100)]
More WIP on closures

4 years agoAdd WIP on passing about closures
Luke Lau [Wed, 24 Jul 2019 15:20:12 +0000 (16:20 +0100)]
Add WIP on passing about closures

4 years agoAllocate heap at the start
Luke Lau [Wed, 24 Jul 2019 13:30:34 +0000 (14:30 +0100)]
Allocate heap at the start

4 years agoFix string addressing and clobbered register
Luke Lau [Wed, 24 Jul 2019 13:29:45 +0000 (14:29 +0100)]
Fix string addressing and clobbered register

4 years agoFix static string addressing
Luke Lau [Wed, 24 Jul 2019 12:21:09 +0000 (13:21 +0100)]
Fix static string addressing

4 years agoAdd darwin target support
Luke Lau [Tue, 23 Jul 2019 22:52:21 +0000 (23:52 +0100)]
Add darwin target support

4 years agoMake the ABI respect stack etc.
Luke Lau [Tue, 23 Jul 2019 16:12:18 +0000 (17:12 +0100)]
Make the ABI respect stack etc.

4 years agoUpdate main for codegen changes
Luke Lau [Tue, 23 Jul 2019 10:14:20 +0000 (11:14 +0100)]
Update main for codegen changes

4 years agoAdd strings and print primitive
Luke Lau [Tue, 23 Jul 2019 10:13:51 +0000 (11:13 +0100)]
Add strings and print primitive

4 years agoRemove C dependency, directly emit _start
Luke Lau [Tue, 23 Jul 2019 07:57:52 +0000 (08:57 +0100)]
Remove C dependency, directly emit _start

4 years agoCodegen if statements
Luke Lau [Tue, 23 Jul 2019 00:36:06 +0000 (01:36 +0100)]
Codegen if statements

4 years agoAdd ast-traverse helper
Luke Lau [Tue, 23 Jul 2019 00:35:16 +0000 (01:35 +0100)]
Add ast-traverse helper

4 years agoRefactor ast "pattern matching" to a single function
Luke Lau [Mon, 22 Jul 2019 23:03:24 +0000 (00:03 +0100)]
Refactor ast "pattern matching" to a single function

4 years agoAdd recursive let-bindings
Luke Lau [Mon, 22 Jul 2019 19:41:24 +0000 (20:41 +0100)]
Add recursive let-bindings

4 years agoFix some normalization issues, add codegen tests
Luke Lau [Mon, 22 Jul 2019 01:37:02 +0000 (02:37 +0100)]
Fix some normalization issues, add codegen tests

4 years agoFirst pass at lambdas and closures
Luke Lau [Mon, 22 Jul 2019 00:28:50 +0000 (01:28 +0100)]
First pass at lambdas and closures

4 years agoAdd pretty printing for types
Luke Lau [Sun, 21 Jul 2019 22:49:41 +0000 (23:49 +0100)]
Add pretty printing for types

4 years agoAdd more binary ops
Luke Lau [Sun, 21 Jul 2019 00:40:02 +0000 (01:40 +0100)]
Add more binary ops

4 years agoResolve types in lambda arguments, recursively substitute
Luke Lau [Sat, 20 Jul 2019 16:48:01 +0000 (17:48 +0100)]
Resolve types in lambda arguments, recursively substitute

Also add test

4 years agoNormalize lambdas to be single arguments only
Luke Lau [Sat, 20 Jul 2019 16:02:28 +0000 (17:02 +0100)]
Normalize lambdas to be single arguments only

4 years agoSplit out compiler into codegen and main
Luke Lau [Wed, 17 Jul 2019 23:35:35 +0000 (00:35 +0100)]
Split out compiler into codegen and main

4 years agoFix up codegen-add for vars
Luke Lau [Wed, 17 Jul 2019 22:23:16 +0000 (23:23 +0100)]
Fix up codegen-add for vars

4 years agoAdd let bindings
Luke Lau [Wed, 17 Jul 2019 22:15:15 +0000 (23:15 +0100)]
Add let bindings

Also split out some helpers into a separate ast file
Need to split compiler out into codegen and main

4 years agoAdd .gitignore
Luke Lau [Wed, 17 Jul 2019 20:54:13 +0000 (21:54 +0100)]
Add .gitignore

4 years agoAdd consolidation, tie up with typechecker
Luke Lau [Wed, 17 Jul 2019 20:53:26 +0000 (21:53 +0100)]
Add consolidation, tie up with typechecker

Also normalize program before typechecking

4 years agoStart typechecker
Luke Lau [Wed, 17 Jul 2019 14:07:58 +0000 (15:07 +0100)]
Start typechecker