25 Commits

Author SHA1 Message Date
Guillaume Melquiond
ed5b718f17 Update keyword list. 2020-02-29 09:00:47 +01:00
Raphael Rieu-Helft
17ed127006 Add support for partial functions
Program functions can be declared as partial with "let/val partial".
Similarly to "diverges", partial code cannot be ghost, however it does not need to be
explicitly specified as partial.

Fixes #184.
2018-09-28 10:31:26 +02:00
Andrei Paskevich
9e6dacc7ca "safe clone": by default, cloned axioms become lemmas
Clone "with axiom ." or "with goal ." to change the default
("with lemma ." is also accepted, just in case).
2018-06-14 21:44:44 +02:00
Raphael Rieu-Helft
6096533200 Merge branch 'new_system' into mp
Conflicts:
	share/emacs/why3.el
	share/latex/why3lang.sty
2017-06-16 15:03:24 +02:00
Andrei Paskevich
df23906140 WhymL: break and continue
Without an argument, break and continue refer to the innermost loop.
A label put over an expression sequence starting with a loop, can be
used as an optional argument for break and continue:

  label L in
  [ghost] ["tag"] [M.begin]
    while true do
      ...
      break L
      ...
    done;
    [...]
  [end] [: unit]

In the square brackets are listed the constructions allowed between
the label declaration and the loop expression.
2017-06-16 14:49:17 +02:00
Raphael Rieu-Helft
5804ead866 Merge branch 'new_system' into mp 2017-06-09 12:38:16 +02:00
Raphael Rieu-Helft
b9633ad1f9 Merge branch 'new_system' into mp
Conflicts:
	share/emacs/why3.el
	share/vim/syntax/why3.vim
	src/mlw/compile.ml
	src/mlw/dexpr.ml
	src/parser/parser.mly
	src/parser/typing.ml
2017-06-09 12:37:50 +02:00
Andrei Paskevich
c23ddb9d68 WhyML: toplevel "import <scope>" declaration 2017-06-08 18:31:27 +02:00
Andrei Paskevich
923f35cc6f add "return" to the syntax files 2017-06-06 02:10:32 +02:00
Andrei Paskevich
e63151cf8b syntax: use "pure { term }" instead of "{| term |}"
Aesthetics is a harsh mistress.
2017-06-04 13:20:01 +02:00
Raphaël Rieu-Helft
db03d325c6 Fix unbound result 2017-03-29 17:02:46 +02:00
Andrei Paskevich
2fbef962ab slightly change coloring
- builtin Why3 connectors and parens are "Operator", not "Keyword"
- square brackets are Normal (just like other used-defined ops)
2016-12-30 02:04:31 +01:00
Andrei Paskevich
36add6167e vim-pathogen compliance
To install the Why3-related Vim files, just create a symbolic link:
  ln -s "$(why3 --print-datadir)/vim" ~/.vim/bundle/why3

Thanks to Johanness Kanig for the suggestion.
2016-10-18 11:08:55 +02:00
Andrei Paskevich
91b9f5bc27 Parser: drop syntax "abstract <spec> <expr_seq> end"
use "begin <spec> <expr_seq> end" instead. The word "abstract" is
now only used to declare a private type whose fields are all ghost.
2016-04-01 16:02:46 +02:00
Andrei Paskevich
a949118f7c Merge remote-tracking branch 'origin/master' into new_system
The only recent change in master currently ignored in
this merge is renaming mach.Array.Array63.array to array63.
If we decide to give array types in mach.Array specific names,
we should do it for every size, and not only for 63 bits.
2016-03-07 18:06:43 +01:00
Martin Clochard
d1b5042e76 byso: by/so in keyword lists 2015-12-10 17:01:48 +01:00
Andrei Paskevich
d048170536 Mlw: "label <uident> in", "<expr> at <uident>", "old <expr>" 2015-07-02 18:47:31 +02:00
Andrei Paskevich
4fd8b24df7 WhyML: change the syntax of "abstract"
The old syntax:   abstract expr [spec]...

The semicolon binds more loosely than "abstract" and
the specification clauses are optional, so that
"abstract e1; e2" is the same as "(abstract e1); e2"
and "abstract e1; e2; ensures {...}" is a syntax error.

The new syntax:   abstract [spec]... expr end

This allows to put sequences of expressions under "abstract"
without ambiguity and moves the specification clauses to the
beginning. In other words, "abstract" becomes a "begin" with
a specification attached. The spec-at-the-top is consistent
with the syntax of functions and the whole seems to be more
natural for the intented use of "abstract" (a logical cut).
2014-02-14 16:08:08 +01:00
Andrei Paskevich
83858597ce WhyML: add "diverges", "reads {}", and "writes {}" effect clauses
- "diverges" states that the computation may not terminate (which
  does not mean that is always diverges: just as any other effect
  annotation, this clause states a possibility of a side effect).

- "reads {}" states that the computation does not access any variable
  except those that are listed elsewhere in the specification (or the
  proper function arguments, if "reads" is in a function spec).

- "writes {}" states that the computation does not modify any mutable
  value.

- If a function definition or an abstract computation may diverge,
  but there is no "diverges" clause in the specification, a warning
  is produced. If a function definition or an abstract computation
  always terminates, but there is a "diverges" clause in the spec,
  an error is produced.

- If there is a "reads" or a "writes" clause in a function definition
  or an abstract computation, then every modified value must be listed
  in "writes" and every accessed external variable not mentioned in
  the spec must be listed in "reads". (Notice that this is a stricter
  requirement than before, when the presence of a "writes" clause
  did not require to specify "reads".) However, one does not have to
  write "reads {}" or "writes {}" if the corresponding lists are empty.
2014-01-20 12:51:32 +01:00
Andrei Paskevich
16ca4a30e1 Why3 vim syntax minor fix 2012-11-05 10:38:22 +01:00
Andrei Paskevich
03d1c7b26e whyml: new specification syntax 2012-10-13 00:23:29 +02:00
Andrei Paskevich
cf739862f4 whyml: error reporting improvements 2012-06-23 21:15:40 +02:00
Jean-Christophe Filliatre
a9bb74b28e coinductive predicates 2012-05-22 15:51:50 +02:00
Andrei Paskevich
6fe2974302 small fix in vim coloring 2012-03-17 18:42:21 +01:00
Andrei Paskevich
2362bfcd04 syntax coloring for Vim 2012-03-11 16:42:10 +01:00