1
1
mirror of https://github.com/github/semantic.git synced 2024-11-27 12:57:49 +03:00
Commit Graph

502 Commits

Author SHA1 Message Date
Timothy Clem
0f56f33f24 Introduce some symbol/tags tests 2018-11-02 13:55:30 -07:00
Timothy Clem
63e13ee20c Merge remote-tracking branch 'origin/master' into docstrings-round2 2018-11-01 16:04:15 -07:00
Timothy Clem
1f6a7b9e48 Move HasTextElement 2018-11-01 14:49:35 -07:00
Patrick Thomson
b9cf8f73c6 Environment and App. 2018-10-31 15:47:30 -04:00
Timothy Clem
d4d19ea21f Some renaming, split out into two modules 2018-10-31 10:58:00 -07:00
Patrick Thomson
d473b9e1af add Data/Abstract/Name/Spec 2018-10-31 13:19:43 -04:00
Patrick Thomson
b0e6190dbf add Data/Range/Spec 2018-10-31 12:46:52 -04:00
Patrick Thomson
cd05aaa7a5 add Data/Graph/Spec 2018-10-31 12:30:56 -04:00
Timothy Clem
945ab01275 Introduce Taggable 2018-10-31 08:34:58 -07:00
Patrick Thomson
cb54dd7aed Merge remote-tracking branch 'origin/master' into repl-effect 2018-10-30 15:58:00 -04:00
Patrick Thomson
3cb8608703 Merge remote-tracking branch 'origin/master' into add-purely-to-matching 2018-10-30 15:00:37 -04:00
Patrick Thomson
da1704af56 Extract the REPL effect into its own module.
I need this for the refactoring OKR.
2018-10-30 14:55:23 -04:00
Patrick Thomson
6b476d0eb7 Add 'purely' combinator to Matching and rename it.
@tclem and I found ourselves wanting an arrow-like combinator that
promotes a given function to a Matcher. While I think an Arrow
instance is going a little overboard, there's no harm in adding a
'purely' function, the naming of which is commensurate with the
rewriting DSL.

This also renames the module, since there's not anything really
abstract about matching (indeed, it is quite concrete).
2018-10-30 11:04:11 -04:00
Rob Rix
636eec364e Update to fused-effects, replace \/ with handleSum and bundle Interpose. 2018-10-29 09:52:48 -04:00
Rob Rix
1414df368d Define a high-level Semantic.Analysis module. 2018-10-25 21:31:38 -04:00
Rob Rix
131cae4d7b Merge branch 'master' into higher-order-effects 2018-10-24 14:04:13 -04:00
Patrick Thomson
ef696d3c41 Split up Semantic.IO.
This looks like a big patch, but it's very straightforward: no
behavior has changed.

After the umpteenth time spent hitting a compile error because I
passed a `FilePath` rather than a `File` to `readBlobFromPath`, I
decided to finally make the needed refactors to Semantic.IO, and to
split off the `File` type and `Files` effect. This patch:

* adds the `MonadIO` class to `Prologue`'s export list
* moves `File` into `Data.File`
* moves `Handle` into `Data.Handle`
* moves `Files` into `Semantic.Task.Files`
* moves functions for reading blobs into `Data.Blob`
* keeps general IO helpers in Semantic.IO
* renames `readFile` to `readBlobFromFile`
* renames `readBlobFromPath` to `readBlobFromFile'`

This should have a positive effect on compile times and ease of
navigation throughout the codebase.
2018-10-23 15:37:49 -04:00
Rob Rix
314aff5d56 Bump higher-order-effects for Resource & some handler helpers. 2018-10-22 20:18:36 -04:00
Patrick Thomson
8800f7072e Turn on -XMonadFailDesugaring globally.
In the past few years, GHC has been moving to remove the `fail` method
from the definition of `Monad`, a longtime wart, and requiring monads
that fail due to an incomplete pattern match to implement `MonadFail`.
You can read about it[here](https://wiki.haskell.org/MonadFail_Proposal).
Though this move is still in progress, we can opt into it by turning
on the `-XMonadFailDesugaring` extension.

The matching and rewriting systems will both benefit from this, as the
incomplete pattern match in following rewrite rule will crash without
`-XMonadFailDesugaring`, even though the sensible and correct thing
for the rule to do is call out to its `MonadFail` instance:

```haskell
-- crashes the program without -XMonadFailDesugaring
getReceiver :: Rule a (Ruby.Send term) term
getReceiver = do
  (Ruby.Send (Just rec) _ _ _) <- target
  pure rec
```

In addition, turning on `MonadFailDesugaring` will warn you if you put
an incomplete pattern match in a monad that doesn't implement `MonadFail`.
This setting will become implicit in GHC 8.6, so this is a good chance
to make sure that we don't introduce any incomplete patterns going forward.
2018-10-22 14:07:48 -04:00
Rob Rix
3ef2efa73a Merge branch 'master' into higher-order-effects 2018-10-22 09:45:57 -04:00
Patrick Thomson
7c8e8c5bf5 Merge remote-tracking branch 'origin/master' into avoid-recompiling-git 2018-10-18 17:22:18 -04:00
Josh Vera
efde121720 Merge branch 'master' into avoid-recompiling-git 2018-10-18 11:28:18 -04:00
Patrick Thomson
f4b5f0d44e [Experiment] Improve compile speed with larger GHC allocation area 2018-10-17 21:27:22 -04:00
Patrick Thomson
379d75f284 Split up Language.Haskell.Syntax into child modules.
This was the longest (in terms of line count) file in the project.
Splitting it up will save on compile time, as it did for TypeScript.
I observe a ~20sec speedup from `stack clean semantic && stack build semantic:lib`
2018-10-17 18:57:29 -04:00
Patrick Thomson
b361c9ef79 Prevent unnecessary recompilation of Semantic.Version in dev mode.
Right now, Semantic.Version is recompiled on every invocation of
`stack build`, since we marked it as `-fforce-recomp` to ensure that
all deployments are tagged appropriately for haystack. However, this
entails a good deal of wasted time during development. With some
liberal application of `CPP`, we can make this recompilation only
happen on CI, thanks to the `release` flag and passing in a compiler
flag.

To test:

* apply the patch
* `stack build semantic`, then `stack exec semantic -- -v`. It should
  print `semantic version 0.4.0 (<development>)`.
* `stack clean semantic && stack build --ghc-options=-DCOMPUTE_GIT_SHA`.
  `stack exec semantic -- -v` should then print out the correct SHA.

Though it's probably not strictly necessary, I've marked the
`semantic` and `semanticd` executables to compile with
-DCOMPUTE_GIT_SHA, just in case.
2018-10-17 17:24:14 -04:00
Patrick Thomson
ac543651ee Add NFData instances to enable more accurate benchmarking.
Because we're getting serious about benchmarking in the run-up to
Windrose, it's time to bring in the `deepseq` package to ensure that
benchmarks can fully evaluate the result of a test case.

The `deepseq` package provides an `NFData` typeclass:

```
class NFData a where
  rnf :: a -> ()
```

Instances use the `seq` combinator to ensure that the argument to
`rnf` is fully evaluated, returning (). If there is a `Generic`
instance for `a`, the implementation can be omitted. This patch adds
NFData for every syntax node, graph vertex, environment data
structures, and exceptions. It is long, but the work is very
straightforward, so don't panick.

The benchmark suite (`stack bench`) now produces more accurate
results. The benchmarks previously mimicked `rnf` by calling `show` on
the result of an evaluation or graph construction; now that we have
actual `NFData` instances we can use the `nfIO` combinator from
criterion. This has sped up the evaluation benchmarks and reduced
their memory consumption, while it has slowed down the call graph
benchmarks, as those benchmarks weren't evaluating the whole of the
graph.

Unfortunately, this patch increases compile times, as we have to
derive a few more Generic instances. I wish this weren't the case, but
there's little we can do about it now. In the future I have some plans
for how to reduce compile time, and I bet that those gains will at
least nullify the speed hit from this patch.

Now that we have NFData instances for every data type, we can start
benchmarking assignments, in preparation for fixing #2205.

This patch also pulls in updates to `effects` and `fastsum` that add
appropriate NFData instances for the data they vend.
2018-10-17 14:08:47 -04:00
Rob Rix
c9e6912068 Port most of the system over to higher-order-effects. 2018-10-16 18:48:08 -04:00
Rob Rix
298d861a20 Add a dependency on higher-order-effects. 2018-10-12 14:08:49 -04:00
Patrick Thomson
d56377aea9 Prevent slowdowns when pretty-printing in ghci.
Right now, when opening a shell with `script/ghci`, you can encounter
a tremendous slowdown by turning on pretty-printing (with `pretty`)
then printing any value (`[0..3]` should work).

This stems from the fact that our `.ghci` specifies the `prettyShow`
function, defined in Semantic.Util, as its `-interactive-print`
function. While this is a good choice of a pretty-printer, the fact
that it is in Util, a file which imports many modules and uses fancy
types, is not good: pretty-printing cannot begin until Util is
recompiled and linked in. This explains why benchmarking this slowdown
revealed nothing but `dlsym` calls: we thought it was due to linking
in the tree-sitter libraries, but it was actually waiting for Util to
compile and link in.

The fix is simple: define `prettyShow` in another module. This should
provide significant speedups to our developer workflow.
2018-10-04 14:38:36 -04:00
Rob Rix
5c2dac35e8 Merge branch 'master' into first-order-closures 2018-09-27 13:37:25 -05:00
Timothy Clem
6b40e59c1d No SplitDiff! 2018-09-27 13:04:51 -05:00
Timothy Clem
c8dfe57a48 Remove Data.Record entirely 2018-09-26 14:05:29 -05:00
Timothy Clem
38a4bb38f2 WIP - replace Record across the project
Not quiet there with Diff and decorators yet
2018-09-21 13:46:25 -07:00
Rob Rix
038b56970e Parameterize Evaluator by the term type. 2018-09-20 12:43:59 -04:00
Patrick Thomson
ba18287311 Merge branch 'master' into reprinting-pipeline-rename 2018-09-19 13:08:52 -04:00
Patrick Thomson
8e1ca410bb Remove Hungarian-style T- prefix from tokens and scopes.
Prefixes on data constructors are generally an antipattern in Haskell:
if you're concerned about name collisions, have clients use qualified
imports for whatever modules they need. As such, this removes the T-
prefixes from the `Token` and `Context` types. This also renames
Context to Scope, which is a more exact and readable name.
2018-09-19 12:38:48 -04:00
Patrick Thomson
22cf72c20f Merge branch 'master' into term-rewriting-mk2 2018-09-19 11:51:28 -04:00
Patrick Thomson
d68c7975d7 Merge branch 'master' into new-take-on-parse-examples 2018-09-18 17:51:22 -04:00
Timothy Clem
6817193cbc Mark assignment timeouts as pending 2018-09-18 13:00:31 -07:00
Patrick Thomson
2dc8bb0041 Merge branch 'master' into term-rewriting-mk2 2018-09-18 15:18:21 -04:00
Rob Rix
13993af2c7 Merge branch 'master' into heap-widening 2018-09-18 14:46:36 -04:00
joshvera
906da72e54 Merge remote-tracking branch 'origin/master' into scopes-and-frames 2018-09-18 12:26:18 -04:00
Patrick Thomson
c2bfde5c95 move Fragment into its own file for clarity's sake 2018-09-18 11:38:10 -04:00
Rob Rix
f3d616fbd1 Merge branch 'master' into heap-widening 2018-09-18 11:17:21 -04:00
Rob Rix
87c609fa1c Duplicate the flow-sensitive caching module. 2018-09-18 10:27:47 -04:00
Rob Rix
58c22658d3 Rename the Caching module to note its flow-sensitivity. 2018-09-18 10:26:50 -04:00
Rob Rix
560c93784c Move the cache into the Caching module. 2018-09-18 10:21:25 -04:00
Rob Rix
86654a2dab Move Configuration into Data.Abstract.Cache. 2018-09-18 10:12:02 -04:00
Rob Rix
51be2081ae 🔥 Control.Abstract.Configuration. 2018-09-18 10:10:03 -04:00
Timothy Clem
38b692b17c Merge remote-tracking branch 'origin/master' into new-take-on-parse-examples 2018-09-17 16:47:00 -07:00
Timothy Clem
31ca888da7 Introduce datatype for these language examples 2018-09-17 16:46:45 -07:00
Timothy Clem
15f7e57571 First pass at doing parse-examples in haskell and hspec 2018-09-17 15:49:18 -07:00
Patrick Thomson
1ba38e3e57 Merge remote-tracking branch 'origin/master' into term-rewriting-mk2 2018-09-17 18:31:44 -04:00
Patrick Thomson
7c35cb524a Merge branch 'master' into bump-synopsis 2018-09-17 16:18:58 -04:00
joshvera
2d071e5090 Remove Data.Abstract.Frame for now 2018-09-17 13:05:24 -04:00
joshvera
5c96b3d6d7 Merge remote-tracking branch 'origin/master' into scopes-and-frames 2018-09-17 12:08:27 -04:00
Patrick Thomson
06b44c4fc9 Replace the "initial project from stack" synopsis.
I figure that since we're starting to show this to other teams, it
behooves our documentation to have a more meaningful description.
Happy to change this if y'all can come up with a snappier synopsis.
2018-09-17 11:21:21 -04:00
joshvera
68ca3b06bc Remove type-combinators dep 2018-09-14 19:04:09 -04:00
Timothy Clem
d2524e194d Merge branch 'master' into assignment-timeout 2018-09-14 14:03:37 -07:00
Patrick Thomson
d1cc400dc0 add spec file 2018-09-14 13:10:22 -04:00
Patrick Thomson
b8b8fe01c9 port over Control.Rewriting 2018-09-14 12:47:21 -04:00
Timothy Clem
a6ce4f672f Docs and sort out a common Duration datatype 2018-09-13 14:51:32 -07:00
Timothy Clem
7e1c7a1c84 Timeout effect 2018-09-13 14:20:42 -07:00
Patrick Thomson
7129435dc8 Merge remote-tracking branch 'origin/master' into simplify-reprinter
also incorporates a number of changes. oops.
2018-09-12 12:14:01 -04:00
Patrick Thomson
0802e0a9f2 Use a deep embedding for Tokenize. 2018-09-11 18:54:37 -04:00
Timothy Clem
2e48678e6b Rework diff grpc api as well, enable for all supported langauges 2018-09-11 10:32:29 -07:00
joshvera
1eac23ce2e Don't parameterize scopes by name 2018-09-10 18:50:40 -04:00
Timothy Clem
c806be4cfc Clean up, expand grpc support to larger language list 2018-09-10 11:43:42 -07:00
Timothy Clem
38e3cba57a Messy, but working multi-lang grpc parsing 2018-09-10 11:15:52 -07:00
Timothy Clem
a15155c4da Basics of TermVertex in grpc 2018-09-06 17:27:13 -07:00
Timothy Clem
f0d164f952 Rework control flow graph data types 2018-09-06 15:12:12 -07:00
joshvera
3ccdbdb692 Merge remote-tracking branch 'origin/master' into scopes-and-frames 2018-09-05 12:54:45 -04:00
joshvera
01af82bf53 WIP 2018-09-04 12:43:14 -04:00
joshvera
3d412f7d9e Add ScopeGraph 2018-08-29 13:47:44 -04:00
Timothy Clem
34648a263a Merge branch 'master' into source-aware-reprinter 2018-08-28 11:34:53 -07:00
Timothy Clem
5da417d01c Some basic pretty printing for mini Python 2018-08-28 09:14:48 -07:00
Timothy Clem
ea01f30de5 Put this back in order 2018-08-28 09:12:44 -07:00
Timothy Clem
8759225ac7 A mini-python 2018-08-28 09:12:29 -07:00
Timothy Clem
57f32c77bd MiniRuby in its own module 2018-08-27 15:06:51 -07:00
joshvera
bc6614aa12 Merge remote-tracking branch 'origin/master' into entry-points 2018-08-27 12:05:20 -04:00
Timothy Clem
e9e8edbebe Dedicated util for rewriting 2018-08-24 10:35:38 -07:00
Timothy Clem
17fbceb17a Remove need for lens 2018-08-23 15:53:43 -07:00
Timothy Clem
8f6d1ee873 Merge branch 'master' into source-aware-reprinter 2018-08-23 07:47:48 -07:00
Timothy Clem
67f652b4d7 Refactor to have 1 additional data representation in the pipeline 2018-08-22 11:30:03 -07:00
Timothy Clem
a1294e91f1 Docs and some renaming 2018-08-21 16:15:08 -07:00
Charlie Somerville
5f6961e737 move Analysis.Abstract.Configuration to Control.Abstract 2018-08-21 13:42:45 +10:00
Charlie Somerville
ec852844cb reshuffle module layout so that Environment can depend on Heap 2018-08-21 13:42:45 +10:00
Timothy Clem
cbdb932af8 Ruby translation step for the pipeline 2018-08-20 18:11:30 -07:00
Timothy Clem
58cf9925fa Not using this 2018-08-20 10:37:24 -07:00
Timothy Clem
3c53862e19 Merge remote-tracking branch 'origin/master' into source-aware-reprinter 2018-08-20 10:17:38 -07:00
Timothy Clem
1dc89961b2 Remove Rule 2018-08-20 09:52:03 -07:00
Timothy Clem
b49adc41fe Move splice to data, allow config for translation 2018-08-17 09:10:14 -07:00
Timothy Clem
f674e2dad1 WIP - translation with Eff interface 2018-08-16 16:51:07 -07:00
Rick Winfrey
1665df55aa Merge branch 'master' into interactive-debugger 2018-08-14 15:04:02 -07:00
Timothy Clem
cd65c8814a Some common matchers 2018-08-14 14:15:18 -07:00
Timothy Clem
487c78b854 Merge remote-tracking branch 'origin/master' into source-aware-reprinter 2018-08-13 15:56:26 -07:00
Rick Winfrey
bdeae17ff6 🔥 unneeded build-depends 2018-08-13 15:43:07 -07:00
joshvera
75365e9caa Merge remote-tracking branch 'origin/master' into interactive-debugger 2018-08-13 16:40:27 -04:00
Rob Rix
9c9fa333d6 🔥 Allocatable & Derefable. 2018-08-13 09:46:46 -04:00
Rob Rix
16964350b0 Stub in a module for the Hole address type. 2018-08-13 09:35:37 -04:00
joshvera
2732f17719 Merge remote-tracking branch 'origin/master' into interactive-debugger 2018-08-10 14:20:16 -04:00
Rob Rix
d05f3c6ae3 🔥 Data.Abstract.Address. 2018-08-10 13:46:24 -04:00
Rob Rix
53a9ca30aa Add modules for the address types. 2018-08-10 13:31:55 -04:00
Josh Vera
44ac28510c Merge branch 'master' into entry-points 2018-08-08 16:17:08 -04:00
Rick Winfrey
383b6208ee Rename ErrorContext -> BaseError 2018-08-07 16:50:55 -07:00
Rob Rix
3c976b3c7f Merge branch 'master' into interactive-debugger 2018-08-07 09:33:53 -04:00
joshvera
967803aae3 Merge remote-tracking branch 'origin/master' into entry-points 2018-08-06 18:57:18 -04:00
Rick Winfrey
823ae6ac51 Merge branch 'master' into error-context 2018-08-06 13:46:42 -07:00
Patrick Thomson
1d6346cb64 set ground for Control.Rule and Control.Rule.Engine 2018-08-06 16:33:50 -04:00
Patrick Thomson
8549440f21 even better names, and a helper script to narrow tests 2018-08-03 13:15:14 -04:00
Patrick Thomson
2ec082d92c implement the typesetting stage 2018-08-03 12:47:54 -04:00
Patrick Thomson
081d8eb6fa Reorganize and add microlens, at least for now. 2018-08-03 12:23:47 -04:00
Rob Rix
dfa3629db4 Add a dependency on haskeline. 2018-08-03 09:25:52 -04:00
Rob Rix
d8cf347822 🔥 the dependency on trifecta. 2018-08-02 16:33:19 -04:00
Rob Rix
9cdcd3c972 Depend on trifecta. 2018-08-02 14:45:55 -04:00
Patrick Thomson
f295632327 move some code around + ensure we can enforce History invariants 2018-08-02 13:03:55 -04:00
joshvera
d3cdda3dff Merge remote-tracking branch 'origin/master' into entry-points 2018-08-01 18:18:33 -04:00
Rob Rix
c6c17a1594 Stub in a module for Quieterm.
Co-Authored-By: Ayman Nadeem <aymannadeem@gmail.com>
2018-08-01 15:06:26 -04:00
Rob Rix
fb12fc3a29 Stub in a REPL module.
Co-Authored-By: Ayman Nadeem <aymannadeem@gmail.com>
2018-08-01 10:54:57 -04:00
Patrick Thomson
76727e07da rename 2018-07-31 17:49:03 -04:00
Patrick Thomson
dccea555ed Extremely ad-hoc renderer to Docs 2018-07-31 12:44:20 -04:00
Patrick Thomson
6823fb92b6 better module name 2018-07-31 10:43:46 -04:00
Patrick Thomson
a61fe301c4 Skeleton and initial test case 2018-07-30 16:00:09 -04:00
Rick Winfrey
4fbad824d9 Define ErrorContext 2018-07-30 11:11:18 -07:00
Rob Rix
3fa75423d6 Move Mergeable into the tests. 2018-07-20 09:52:43 -04:00
Patrick Thomson
c8ec92ceb4 Make L.TS.Syntax an exports-only module. 2018-07-19 17:23:44 -04:00
Patrick Thomson
c647a558c6 add Syntax.JSX and Resolution 2018-07-19 17:05:44 -04:00
Patrick Thomson
587b97ffa5 Add -Wmissing-export-lists to semantic. 2018-07-19 14:56:58 -04:00
Patrick Thomson
bdd75e6e7c Add export lists to modules missing them. 2018-07-19 14:45:04 -04:00
Patrick Thomson
361f62c812 Rename ImportGraph to AdjacencyList 2018-07-17 11:35:03 -04:00
Patrick Thomson
0ed48c7bbe Simplest test possible. 2018-07-16 11:07:40 -04:00
Timothy Clem
aa480be46d 🔥 old import graph summary
This hasn't been in the CLI for a while now
2018-07-06 13:35:09 -07:00
Rob Rix
2a6b1dd109 Move Data.Abstract.Type to Data.Abstract.Value.Type. 2018-07-04 10:46:13 -04:00
Rob Rix
de7ac163d6 Stub in a module for abstract value semantics. 2018-07-04 09:21:51 -04:00
Rob Rix
5100670e72 Rename Data.Abstract.Value to Data.Abstract.Value.Concrete. 2018-07-03 14:22:26 -04:00
Rob Rix
c338fca8b0 Stub in a module for deterministic assignments. 2018-06-27 14:27:15 -04:00
Josh Vera
5538c6b490 Merge branch 'master' into explicit-integer-parser 2018-06-26 17:10:21 -04:00
Patrick Thomson
98030486eb rename AdjList to ImportGraph 2018-06-26 16:54:09 -04:00
Patrick Thomson
bbf814acc1 Merge remote-tracking branch 'origin/master' into import-graph-mk2 2018-06-26 13:49:24 -04:00
Patrick Thomson
f9f0dd5e79 Use a hand-written integer parser.
Rather than relying on the `Read` instance for `Integer`, let's make
our assumptions about the format explicit. This was mostly a matter of
extracting internal functions from the `Scientific` parser.
2018-06-25 11:55:32 -04:00
Rob Rix
dda4c00cb5 🔥 Evaluating. 2018-06-21 13:26:22 -04:00
Patrick Thomson
de5792ef38 will this fix the cabal file? only time will tell 2018-06-18 19:22:42 -04:00
Rob Rix
d39171e9d7 Determine Preludes from the language. 2018-06-18 11:09:01 -04:00
Patrick Thomson
659500551c Merge remote-tracking branch 'origin/master' into import-graph-mk2 2018-06-15 19:30:50 -04:00
Timothy Clem
0ddf994a81 Merge branch 'master' into telemetry-and-config 2018-06-15 10:40:06 -07:00
Patrick Thomson
62d238df09 🔥 Preluded and make prelude paths simpler/explicit
Preluded was overengineered anyway.
2018-06-15 11:49:26 -04:00
Rob Rix
da19e87b80 Depend on semilattices in the tests. 2018-06-15 11:40:26 -04:00
Rob Rix
bf06d928c9 Replace Data.Semilattice.Lower with semilattices. 2018-06-15 11:37:49 -04:00
Rob Rix
54ea58fd79 Move the proto3 packages down. 2018-06-15 11:06:26 -04:00
Timothy Clem
a1949ae322 Re-order 2018-06-13 16:39:13 -07:00