Commit graph

1223 commits

Author SHA1 Message Date
Evan Czaplicki
b1dd1574a8 Begin passing module interfaces when compiling dependencies 2013-07-21 07:14:13 +02:00
Evan Czaplicki
22f7f8a43a Create a serializable interface for a module's type information
Also add a flag to print out top-level types
2013-07-21 06:08:08 +02:00
Evan Czaplicki
0c14f6e8ec add note about (,,) in types 2013-07-21 00:15:49 +02:00
Evan Czaplicki
fa11f8e390 get rid of unused imports 2013-07-21 00:15:35 +02:00
Evan Czaplicki
5cb82c6891 Add support for "(,,) a b c" as a valid type annotation 2013-07-20 18:53:41 +02:00
Evan Czaplicki
1a4732a436 Start building a .elmi file that contains the types of all top-level functions 2013-07-20 18:53:15 +02:00
Evan Czaplicki
c9a1cc96f6 Minor reformatting and removing unused dependencies 2013-07-20 18:52:43 +02:00
Evan Czaplicki
23758290d9 Improve pretty printing for types 2013-07-19 19:17:51 +02:00
Evan Czaplicki
9592d286bb Start using Data.Graph to work out dependency problems and other minor tweaks
Print out the saved type environment, and get things working with the
program field in MetadataModule.
2013-07-19 18:05:31 +02:00
Evan Czaplicki
ca4502b70a Save the current environment on CSaveEnv 2013-07-19 18:03:28 +02:00
Evan Czaplicki
b0f96a2eab Switch from [Def t v] to (LExpr t v) for program representation 2013-07-19 18:02:24 +02:00
Evan Czaplicki
4dc68acd60 Stop creating types for ADT's, use Constant and Flexible in the right place 2013-07-19 18:01:26 +02:00
Evan Czaplicki
4c0f716aef Change the representation of SolverState to have a "saved environment", recognize the "Save the Environment" variable 2013-07-19 17:50:16 +02:00
Evan Czaplicki
807076ad57 Add CSaveEnv, optimize CAnd, make it prettier
CSaveEnv is a special constraint that indicates that the current
environment should be saved for later use.

(/\) now optimizes away arguments that are already CTrue.
2013-07-19 17:48:41 +02:00
Evan Czaplicki
648cbd49dd Use letters for arguments in adt constructors 2013-07-19 17:46:03 +02:00
Evan Czaplicki
c942afea6a Nicer pretty printing and a special variable to "Save the Environment" 2013-07-19 17:45:16 +02:00
Evan Czaplicki
c1aef789ee Flatten lets only during JavaScript generation 2013-07-19 17:43:37 +02:00
Evan Czaplicki
ce652d9a35 Print errors more nicely 2013-07-19 15:40:37 +02:00
Evan Czaplicki
45b43e8757 When creating a named var, allow it to be flexible. 2013-07-19 13:25:51 +02:00
Evan Czaplicki
26738907c6 Make error message in solver slightly more specific 2013-07-19 12:41:37 +02:00
Evan Czaplicki
b540fb43b0 Fix bug in generating Def for ADT constructors
Accidentally used the type name instead of the constructor name.
2013-07-19 12:39:38 +02:00
Evan Czaplicki
b87e45a27d Change module prefixes for some values 2013-07-19 11:19:51 +02:00
Evan Czaplicki
c881bd8ef2 Fix bug in type application when converting SourceSyntax.Type to Type.Type
Also get rid of some print statements.
2013-07-18 18:16:54 +02:00
Evan Czaplicki
901179c10f Marginally better errors when a variable is undefined. 2013-07-17 19:30:40 +02:00
Evan Czaplicki
a3a7b3ef62 Refactor type environment
Migrate some functions to Environment.hs, add built-in types like _List
and _Tuple2.
2013-07-17 19:29:27 +02:00
Evan Czaplicki
90c5c7d21c Add terse way to do type application 2013-07-17 19:26:42 +02:00
Evan Czaplicki
334d39c644 Manual dead code elimination ;) 2013-07-17 19:25:17 +02:00
Evan Czaplicki
1d1083600f Fix naming bug for List type 2013-07-17 19:24:56 +02:00
Evan Czaplicki
e852ae25e3 Add field to MetadataModule for datatypes 2013-07-17 19:24:40 +02:00
Evan Czaplicki
fceb46dd4e Try to support polymorphic pattern matching
Expands each pattern into basic PVars to attempt to recover polymorphis
through the same mechanism. Need to test further.
2013-07-16 21:46:06 +02:00
Evan Czaplicki
3bb618bcde Provide the type *and definition* for data constructurs during type checking 2013-07-16 21:44:41 +02:00
Evan Czaplicki
82983a6f24 Update more modules to use the MetadataModule data structure 2013-07-16 21:43:56 +02:00
Evan Czaplicki
8145e600fc Create MetadataModule for more refined information about modules
Used in most places to break a module into more orthogonal components.
Some of this data needs to be serialized into the interface files.
2013-07-16 21:42:37 +02:00
Evan Czaplicki
621a9c2d2e Add a way to flatten lets that have become nested 2013-07-16 21:40:11 +02:00
Evan Czaplicki
0cfae2e43b More specific imports 2013-07-16 21:38:43 +02:00
Evan Czaplicki
640f98e7d5 Rename functions and modules 2013-07-16 21:38:20 +02:00
Evan Czaplicki
1ffaad1f5c Create an isOp function for strings. 2013-07-16 21:37:48 +02:00
Evan Czaplicki
91be5a0c03 Rename the parser. 2013-07-16 16:02:04 +02:00
Evan Czaplicki
025b7a1ea4 Update changelog with latest parser improvements. 2013-07-16 14:58:02 +02:00
Evan Czaplicki
ce357b3d0d Switch to reporting errors with [Doc] for prettier layout. 2013-07-16 14:52:50 +02:00
Evan Czaplicki
1c9da4bf9c Force whitespace between number and operator in infix declarations. 2013-07-16 14:50:35 +02:00
Evan Czaplicki
8590c6bd18 Add parsing for infix declarations. No support for actually using this
information though.
2013-07-16 14:39:58 +02:00
Evan Czaplicki
72bd5cb8eb Clean out this file, getting rid of dead code and adding some types. 2013-07-16 14:39:26 +02:00
Evan Czaplicki
a5bc960067 Minor cosmetic changes 2013-07-16 00:40:11 +02:00
Evan Czaplicki
67ef1ec77b Create the Type.Inference module which handles type inference from
start to finish. Give it a Module and it returns a dictionary mapping
top-level values to types.
2013-07-16 00:38:31 +02:00
Evan Czaplicki
18adffc06d Turn unary negation back on. 2013-07-16 00:36:34 +02:00
Evan Czaplicki
90d50dbb13 Turn off unary negation parsing for now. It has weird behavior when
paired with function calls:

  (- sqrt 9)   -- parse error
  (-sqrt 9)    -- type error, cannot negate function
  -(sqrt 9)    -- this works
  - (sqrt 9)   -- parse error
  - sqrt 9     -- parse error
2013-07-15 12:22:04 +02:00
Evan Czaplicki
2b9886336f Fix parsing of unary negation when it is the first thing in parentheses. 2013-07-15 11:53:53 +02:00
Evan Czaplicki
93a948cd67 Add back in checks for duplicate and out-of-order definitions. 2013-07-15 01:06:00 +02:00
Evan Czaplicki
1fcb01f743 Finish switching over to '_Tuple' format for tuples. 2013-07-15 01:05:14 +02:00