Commit Graph

1226 Commits

Author SHA1 Message Date
Iavor S. Diatchki
baa19ce362 Checkpoint. 2017-01-30 18:14:10 -08:00
Iavor S. Diatchki
9bb61ec9a2 Add PTrue and Error to the syntax (not yet used) 2017-01-30 10:55:08 -08:00
Iavor S. Diatchki
c3ce33f5a6 Remove old stuff 2017-01-30 10:54:45 -08:00
Iavor S. Diatchki
10cf6f16e3 Print stats about the prover. Fixes #392 2017-01-27 16:14:37 -08:00
Iavor S. Diatchki
ecdb774abb Show information about precedence and fixity in the operator help. Fixes #391 2017-01-27 10:59:17 -08:00
Iavor S. Diatchki
09dc9b4655 Distinguish success and failure when returning to the OS. Fixes #390
Currently we only distinguish between success and failure, but in the
future we could add more error codes if that would be useful.

XXX: Mostly the code is written to return an `CommandExitCode` and then
exit at the top level, but there are a few functions that exit directly
(e.g., the setup function).  It would be nice to clean that up.
2017-01-27 10:37:20 -08:00
Brian Huffman
08a7982a46 Use correct default value for symbolic indexing. Fixes #388.
We now use the zero value of the element type as the
default; previously we were incorrectly using the zero
value of the *index* type.
2016-12-13 17:40:57 -08:00
Robert Dockins
e48f430b30 Fix a mismatch when eta-expanding infinite streams that was
causing Cryptol to panic.  We now expect the `TVStream` type
constructor when eta-expanding streams, which is correct.

Fixes #386
2016-11-17 18:15:58 -08:00
Robert Dockins
5b502eccd7 Fix the concrete implementation of the 'pdiv' and 'pmod' primitives
to correctly handle the special case where the length of the dividend
is less than the degree of the divisor polynomial. In this special case
the quotient is always zero and the remainder is equal to the dividend
(zero extended if necessary to fit the output type).

Fixes #384
2016-10-04 15:15:56 -07:00
Brian Huffman
dafd48cad0 Simplify type of primitive function 'pmult'. Fixes #366.
Old: (fin a, fin b) => [a] -> [b] -> [max 1 (a + b) - 1]
New: (fin a, fin b) => [1 + a] -> [1 + b] -> [1 + a + b]
2016-09-20 15:13:40 -07:00
Brian Huffman
2300a73a76 Add regression test for issue #382. 2016-09-20 11:25:01 -07:00
Brian Huffman
d895c97c8b expect* functions use correct argument order for mismatch
The `Type` argument is always the "expected" type (not the
"inferred" type) and so it should be the first argument to
`TypeMismatch` or `unify`.

Fixes #382.
2016-09-20 11:24:24 -07:00
Brian Huffman
6c2f0fc399 Fix typo: "defintion" -> "definition" 2016-09-20 10:22:16 -07:00
Brian Huffman
0c116c5fa7 Show missing/unexpected field names on type mismatch errors
Fixes #357.

However, sometimes it shows the types in the wrong order
due to issue #382.
2016-09-20 09:39:00 -07:00
Brian Huffman
7ccea5dd98 Rename function "endComent" to "endComment" 2016-09-19 15:20:33 -07:00
Brian Huffman
22bb49b3b5 Add regression test for issue #368. 2016-09-19 11:57:06 -07:00
Brian Huffman
60fd82f22b Allow *,+,-,!,^^ to be defined with infix patterns.
Now the declaration "x * y = rhs" can be used to define
a function named (*) without causing a parse error.

Note that "x # y = rhs" cannot be used to define (#),
as it parses as a pattern binding that defines x and y.

Fixes #368.
2016-09-19 11:56:42 -07:00
Brian Huffman
6247faa2c8 Add '.' and ':' to the set of allowable operator symbols.
This fixes part of #368.
2016-09-19 11:50:30 -07:00
robdockins
7a4cbc8e03 Merge pull request #374 from thoughtpolice/fix-terminal-use
Fix up terminal title usage and color output
2016-09-15 09:51:58 -07:00
Brian Huffman
6d6a6ca90c Preserve parens when parsing list enumeration arguments.
List enumeration arguments are parsed as expressions and
then converted to types afterward. Previously parenthesis
productions were dropped; e.g. "[1..(2+2)*(3+3)]" was
parsed as "[1..2+2*3+3]" before resolving infix precedence.
This is now fixed.

Fixes #379.
2016-09-14 15:13:38 -07:00
Robert Dockins
a048690e3a Use more efficent algorithms based on barrel-shifters for implementing
shifts and rotates in the symbolic backend.
Fixes #376
2016-08-25 12:04:58 -07:00
Robert Dockins
14af3690c6 Update the SIV example to avoid issue #375. 2016-08-23 14:08:15 -07:00
Robert Dockins
cd9ffed00b Update examples to use (/\) instead of (&&) where appropriate,
and to squash other warnings related to the upcomming precedence change.
2016-08-22 18:14:44 -07:00
Robert Dockins
e9c8b6ccd1 Add regression test for bitshift operations 2016-08-22 15:36:16 -07:00
Robert Dockins
fd164aa1f9 Repair the implementation of the shift and rotate operations in the
symbolic simulator.  They were previously calculating incorrect
answers for certain bit sequences.
2016-08-22 14:41:23 -07:00
Robert Dockins
3c270cb5ce Fix a typo in the implementation of the (>>) primitive. This was causing
incorrect cacluations when applied to certain bit sequences.
2016-08-22 14:29:42 -07:00
Austin Seipp
1f4b9518a3 Add a --color command line option
This command has three options: 'auto', 'none', and 'always'. They're
fairly self explanatory. 'auto' is the default, and detects that the
terminal output is not equal to `dumb`, and that `stdout` is a
terminal handle.

The choice of option has no impact on whether the title sequence is
sent to the ANSI terminal. That is always detected automatically and
independently of this option.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
2016-08-19 19:17:58 +00:00
Austin Seipp
c897575af5 Only set console terminal title when stdout supports ANSI sequences
In some environments, setting the terminal title does not work, like
Emacs. This results in very ugly output when using Cryptol as a REPL
inside emacs with cryptol-mode, because Emacs merely repeats the
escape sequences back to you, completely ruining the main REPL.

This patch only sets the terminal if the `stdout` handle is detected
to support ANSI escape sequences. This is an adequate check for
setting the title. Note the exact semantics are to check that the
output is a terminal, and that `TERM` is not set to `dumb`, which is
what Emacs sets it to. In the future, `shouldSetREPLTitle` may be
expanded to include other cases if that isn't enough.

Note a subtle point about this: the function to check this case is
very specifically named, because while we may not be able to support
certain terminal codes, we *can* support ANSI escape sequences in
places like Emacs, reliably.

Thus, this patch does not have any changes to the color output: that
should be handled by a follow up patch (that allows either autodetect,
or explicit enable/disable, on the command line). Then, Emacs will be
able to explicitly request color support for the REPL when invoked,
while the REPL code itself will reliably abstain from setting the
title in such environments automatically. There shouldn't ever be a
need to export some '--set-ansi-terminal-title' flag with this logic.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
2016-08-19 18:52:54 +00:00
Robert Dockins
12bbfb5d7d Make parts of the lexer more strict. This squashes a minor space leak. 2016-08-18 16:05:23 -07:00
Robert Dockins
3becedd910 Update tests to remove spurious failures 2016-08-18 16:05:23 -07:00
Brian Huffman
c5f33ab478 Fix compiler warnings 2016-08-17 11:39:00 -07:00
Brian Huffman
fb9f4e2a56 Make fastTypeOf support tuple/record selectors on lists 2016-08-17 09:53:26 -07:00
Robert Dockins
a774bcca5b Begin issuing warnings whenever the fixity is used to disambiguate
parses involving (&&) and (||) relative to the comparison operators,
or between (&&) and (^).  These operators are scheduled to change
fixity levels. See issue #241.
2016-08-16 16:29:49 -07:00
Robert Dockins
7d8f0e2385 Fix an incorrect error message 2016-08-16 16:24:31 -07:00
Robert Dockins
28d4f1d3fe Modify 'updates' and 'updatesEnd' to take the indices and values
as separate vector arguments, rather than as a single vector
argument of pairs.
2016-08-16 14:36:46 -07:00
Robert Dockins
64267f51ac Add the short-cutting boolean operators (/\), (\/), and (==>)
to the Cryptol prelude.  This is in service of eventually addressing
issue #241.
2016-08-12 17:12:34 -07:00
Robert Dockins
f6f1d84770 Update the Cryptol documentation with the new 'update' primitives 2016-08-12 16:18:11 -07:00
Robert Dockins
af0db1af38 Fix minor typo in the Cryptol prelude that was messing up the
help text for (!!)
2016-08-12 16:13:32 -07:00
Robert Dockins
f746ef0d66 Fix test suite after changes to Cryptol prelude altered output 2016-08-12 12:22:58 -07:00
Robert Dockins
dae3ab11b1 Change the representation and caching of sequences for better performance.
There are two major changes in this patch.  The first is that sequence maps
now have special representations for point updates, of the sort produced by
the 'update' and 'updateEnd' primtives.  These updates are stored in a
finite map, rather than as a functional-update thunk using lambdas; this
reduces memory usage and improves time efficecy of sequences defined by
sequences of updates.

The second change is that the caching policy for sequences is changed
to retain all previously-calculated values.  This is a change from the
previous LRU policy, which retained only a small finite number of previous
values.  Benchmarking showed that unbounded memoization was better for
performance in essentially all cases over both an LRU and an adaptive
caching strategy.  The potential downside is that we may retain values
longer than necessary.  If this becomes a problem, we may need to revisit
this decision.
2016-08-12 12:10:49 -07:00
Robert Dockins
c484a8c253 Implement 'update' primitives for the symbolic simulator 2016-08-12 12:10:49 -07:00
Robert Dockins
785687a67f Add new vector update primitives 'update' and 'updateEnd' which update
vectors at indices starting from the beginning/end of the vector,
respectively.

Included in this patch are implementations of these primitives
for the concrete evaluator.  Symbolic primitives are TODO.
2016-08-12 12:10:48 -07:00
Trevor Elliott
b16a1b8909 Fix name introduction for newtypes
The newtype doesn't introduce two distinct names, but just one that is re-used
at the type and expression level. This is OK, as the two namespaces are
distinct, thus there is no ambiguity.

Fixes #369
2016-08-12 11:44:16 -07:00
Brian Huffman
46793ade99 Rename test "issue289" to "trac289"
Renamed because this test does not correspond
to github issue number 289.
2016-08-10 14:07:11 -04:00
Brian Huffman
d53edee9f1 With :set ascii=on, print quotation marks around strings 2016-08-10 14:02:14 -04:00
Robert Dockins
b5a25f4f47 Fix an issue where literal sequences of bit values were being
incorrectly reversed.
2016-08-10 13:55:54 -04:00
Brian Huffman
0024dd0300 Update test output 2016-08-10 13:49:09 -04:00
Adam C. Foltzer
2f64119440 split benchmark XML into separate files
This will hopefully yield better scale in the graphs on the Jenkins job
2016-08-09 14:05:30 -04:00
Adam C. Foltzer
1a68b4f640 add benchmarks for Extras
There are separate benchmarks for the Extras.cry module and the combined
Prelude + Extras module because the performance characteristics are nonlinear.
2016-08-09 13:47:25 -04:00
Adam C. Foltzer
9ad1ff98c6 fixes #363 2016-08-09 11:42:53 -04:00