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.
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
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.
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.
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.
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>
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>
parses involving (&&) and (||) relative to the comparison operators,
or between (&&) and (^). These operators are scheduled to change
fixity levels. See issue #241.
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.
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.