1. 18 Feb, 2019 1 commit
    • Guillaume Melquiond's avatar
      Rework numerical constants. · d3d7c7ac
      Guillaume Melquiond authored
      Main changes are:
      - Real constants now offer a normalized representation usable for internal
        computations.
      - Constants are no longer stored in textual form.
      d3d7c7ac
  2. 11 Feb, 2019 1 commit
  3. 14 Oct, 2018 1 commit
  4. 28 Sep, 2018 1 commit
    • Raphael Rieu-Helft's avatar
      Add support for partial functions · 17ed1270
      Raphael Rieu-Helft authored
      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.
      17ed1270
  5. 11 Sep, 2018 1 commit
    • Guillaume Melquiond's avatar
      Remove handcrafted error messages (fix issues #150 and #172). · ce21b6c1
      Guillaume Melquiond authored
      Short story: it was a source of bugs, there was only one handcrafted
      message over 650, and, to quote François Pottier, "you seem to have
      misunderstood what the various commands do".
      
      Long story: the proper steps to update the error messages after modifying
      the parser are
      
      1. update the old states with --update-errors
      2. generate the new states with --list-errors
      3. compare the old and new states with --compare-errors
      4. manually reconcile the differences between the old and new states
      5. write error messages for the new states
      6. add %on_error_reduce and go back to step 1, if step 5 is too hard
      7. check that the error messages for the old states are still meaningful
      8. check that the set of states is both correct (--compile-errors) and
         complete (--compare-errors)
      
      We were doing only step 1 and half of step 8. Doing the other half of
      step 8 would have prevented issue #172 from occurring. But that would have
      meant doing step 4 after each parser modification, which was never done.
      Note that step 2 is so expensive that it is impossible to perform step 8
      during continuous integration.
      
      Given the work needed to update the error messages after a syntax change,
      I don't think we can reliably use them until WhyML no longer evolves.
      ce21b6c1
  6. 25 Jul, 2018 1 commit
  7. 17 Jul, 2018 1 commit
    • Andrei Paskevich's avatar
      Ident: disambiguated symbolic notation · 295cacf4
      Andrei Paskevich authored
      It is possible to append an arbitary number of quote symbols
      at the end of an prefix/infix/mixfix operator:
      
                  applied form      standalone form
      
                    -' 42               (-'_)
                    x +' y              (+')
                    a[0]' <- 1          ([]'<-)
      
      Pretty-printing will use the quote symbols for disambiguation.
      
      The derived symbols can be produced by Why3 by appending
      a suffix of the form "_toto" or "'toto". These symbols can
      be parsed/printed as "(+)_toto" or "(+)'toto", respectively.
      295cacf4
  8. 27 Jun, 2018 2 commits
  9. 30 May, 2018 1 commit
  10. 15 May, 2018 1 commit
  11. 01 May, 2018 1 commit
    • Sylvain Dailler's avatar
      Tentatively add new error handling mode of menhir · 68532c3b
      Sylvain Dailler authored
      This commit tries to add the new parsing errors from menhir. It changes
      the lexer so that precise error made from the provided handcrafted.messages
      can be displayed on failure.
      Also fix #111
      
      * Makefile.in
      This adds a rule for src/parser/parser_messages.ml which either compile
      the messages or regenerates them. It needs regeneration when changes are
      added in .mly or .messages file. This also adds option .DELETE_ON_ERROR.
      
      * src/parser/lexer.mll
      The parser now uses loop_handle function from menhir (see menhir ref.
      manual).
      
      * src/parser/report.ml
      Added file from Compcert's preparser to report error from "checkpoint". It
      allows to use $0 notation in handcrafted.messages
      
      * src/parser/handcrafted.messages
      To be edited file for error messages.
      
      * bench/*
      Adding a parsing-bench for parsing errors following the model of ce-bench:
      an oracle is provided so that error messages are not lost.
      68532c3b
  12. 16 Apr, 2018 3 commits
  13. 22 Feb, 2018 1 commit
  14. 21 Feb, 2018 1 commit
  15. 12 Jan, 2018 2 commits
  16. 11 Jan, 2018 1 commit
  17. 13 Dec, 2017 1 commit
  18. 23 Nov, 2017 1 commit
  19. 22 Nov, 2017 1 commit
  20. 13 Jul, 2017 1 commit
  21. 05 Jul, 2017 1 commit
    • MARCHE Claude's avatar
      ITP: support for qualified ident and infix ident · bccdfacc
      MARCHE Claude authored
      command "search" and transformations taking idents as arguments now can
      support qualified idents and infix symbols.
      
      For example, "search (+) (*)" returns the distributivity axioms
      
      FIXME: "search Int.(+)" fails, probably missing namespaced for
      imported modules
      bccdfacc
  22. 29 Jun, 2017 1 commit
  23. 16 Jun, 2017 2 commits
    • Andrei Paskevich's avatar
      alias specification: reviewed · f23ed837
      Andrei Paskevich authored
      f23ed837
    • Andrei Paskevich's avatar
      WhymL: break and continue · df239061
      Andrei Paskevich authored
      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.
      df239061
  24. 08 Jun, 2017 1 commit
    • Andrei Paskevich's avatar
      Parser: recognize negative numerals · fe59898d
      Andrei Paskevich authored
      At this moment, there is no semantics change. This commit only
      provides dedicated grammar rules for negated numerals, so that
      we do not have to recognize them later.
      fe59898d
  25. 05 Jun, 2017 1 commit
    • Andrei Paskevich's avatar
      Mlw: labels can act as local exceptions · cda6d915
      Andrei Paskevich authored
      Useful to break out of the loops:
      
        label Break in
        while ... do
          label Continue in
          ... raise Break ...
          ... raise Continue ...
        done
      
      When a label is put over a non-unit expression,
      raise acts as return:
      
        label Return in
        if ... then raise Return 42; 0
      
      Also, "return <expr>" returns from the innermost function.
      This includes abstract blocks, too, so if you want to return
      across an abstract block, you should rather use a label at
      the top of the main function. TODO/FIXME: maybe we should
      let "return" pass across abstract blocks by default, to
      avoid surprises?
      
      One shortcoming of the labels-as-exceptions is that they cannot
      be used to transmit tuples with ghost elements, nor return ghost
      values from non-ghost expressions. A local exception with an
      explicit mask should be used instead. Similarly, to return
      a partially ghost value from a function, it must have have
      its mask explicitly written (which is a good practice anyway).
      We cannot know the mask of an expr before we construct it,
      but in order to construct it, we need to create the local
      exceptions first.
      
      Another caveat is that while it is possible to catch an exception
      generated by a label, you should avoid to do so. We only declare
      the local exception if the expression under the label _raises_
      the exception, and thus the following code will not typecheck:
      
        label X in (try raise X with X -> () end)
      
      Indeed, the expression in the parentheses does not raise X,
      and so we do not declare a local exception X for this label,
      and so the program contains an undeclared exception symbol.
      cda6d915
  26. 04 Jun, 2017 1 commit
  27. 27 May, 2017 1 commit
    • Andrei Paskevich's avatar
      Mlw: support Epure in the surface language (with type inference) · 72714897
      Andrei Paskevich authored
      The current syntax is "{| <term> |}", which is shorter than
      "pure { <term> }", and does not require a keyword. Better
      alternatives are welcome.
      
      As for type inference, we infer the type pf the term under Epure
      without binding destructible type variables in the program.
      In particular,
        let ghost fn x = {| x + 1 |}
      will not typecheck. Indeed, even if we detect that the result
      is [int], the type of the formal parameter [x[ is not inferred
      in the process, and thus stays at ['xi].
      
      Another problem is related to the fact that variable and function
      namespaces are not yet separated when we perform type inference.
      Thus both fuctions
        let ghost fn (x: int) = let x a = a in {| x + 5 |}
      and
        let ghost fn (x: int) = let x a = a in {| x 5 |}
      will not typecheck, since the type of [x] is ['a -> 'a] when
      we infer the type for the Epure term, but it becomes [int],
      when we construct the final program expression. Probably,
      the only reasonable solution is to keep variables and
      functions in the same namespace, so that [x] simply can
      not be used in annotations after being redefined as a
      program function.
      72714897
  28. 24 May, 2017 1 commit
  29. 12 Apr, 2017 1 commit
  30. 28 Mar, 2017 1 commit
  31. 28 Feb, 2017 1 commit
    • Clément Fumex's avatar
      Add the ability to · f0547868
      Clément Fumex authored
      * declare range types and float types,
      * use integer (resp. real) literals for those types through casting,
      * specify how to print them in drivers.
      
      Change in syntax
      * use
      
        type t = < range 1 2 >   (* integers from 1 to 2 *)
        type t' = < float 4 12 > (* float with 4 bits in exponent and 12 in mantissa *)
      
        the two projections :
        t'int
        t''real
      
        and the predicate :
        t''isFinite
      
      * Restrict the use of "'" in whyml:
        Users are not allowed to introduce names where a quote symbol
        is followed by a letter. Thus, the following identifiers are
        valid:
      
        t'
        toto'0''
        toto'_phi
      
        whereas toto'phi is not.
      
      Note: we do not yet support negative numbers in range declaration
      and casting of a literal.
      f0547868
  32. 22 Sep, 2016 1 commit
  33. 15 Mar, 2016 3 commits