1. 23 Oct, 2018 12 commits
    • Andrei Paskevich's avatar
      Merge branch 'autodereference' · 10e54f43
      Andrei Paskevich authored
      Auto-dereferencing references:
      
          let &x = ... in                     let (x: ref ...) = ... in
          f x;                    ---->       f x.contents;
          x <- ...                            x.contents <- ...
      
        -- recommended sugar:
      
          let ref x = ...          ==>        let &x = ref ...
      
        The & marker adds the typing constraint (x: ref ...)
      
        Top-level "let/val ref" and "let/val &" are allowed.
      
        Auto-dereferencing works in logic, but such variables
        cannot be introduced inside logical terms.
      
      Extension to pattern matching:
      
          match e with                        match e with
          | (x,&y) -> y           ---->       | (x,(y: ref ...)) -> y.contents
          end                                 end
      
      Extension to function parameters and reference passing:
      
          let incr (&x: ref int) =            let incr (x: ref int) =
            x <- x + 1                          x.contents <- x.contents + 1
                                  ---->
          let f () =                          let f () =
            let ref x = 0 in                    let x = ref 0 in
            incr x;                             incr x;
            x                                   x.contents
      
        -- recommended sugar:
      
          let incr (ref x: int)    ==>        let incr (&x: ref int)
      
        The type annotation is not required. Let-functions with such
        formal parameters also prevent the actual argument from
        auto-dereferencing when used in logic. Pure logical symbols
        cannot be declared with such parameters.
      
        Auto-dereference suppression does not work in the middle of
        a relation chain: in "0 < x :< 17", x will be dereferenced
        even if (:<) expects a ref-parameter on the left.
      
      Caller-side suppression of auto-dereference:
      
          let f () =                          let f () =
            let ref x = 0 in      ---->         let x = ref 0 in
            g &x                                g x
      
        The & marker can only be attached to a variable. Works in logic.
      
      Ref-binders and &-binders in variable declarations, patterns,
      and function parameters do not require importing ref.Ref.
      Any example that does not use references inside data structures
      can be rewritten by using ref-binders, without importing ref.Ref.
      
      Explicit use of type symbol "ref", program function "ref",
      or field "contents" require importing ref.Ref or why3.Ref.Ref.
      Operations (:=) and (!) require importing ref.Ref.
      
      Operation (:=) is fully subsumed by direct assignment (<-).
      
      TODO: find good terminology for documentation. We want to avoid
      confusion with regular OCaml-style references.
      10e54f43
    • Andrei Paskevich's avatar
      update extraction drivers and Mlinterp · 67c1adfb
      Andrei Paskevich authored
      67c1adfb
    • Andrei Paskevich's avatar
      Parser: some restructuring · 8de79cf7
      Andrei Paskevich authored
      8de79cf7
    • DAILLER Sylvain's avatar
      Merge branch '219_apply2' into 'master' · 25315953
      DAILLER Sylvain authored
      fix #219 Use snapshot of printers to display messages. Improve error.
      
      Closes #219
      
      See merge request !49
      25315953
    • Sylvain Dailler's avatar
      fix #219 Use snapshot of printers to display messages. Improve error. · 053bf85e
      Sylvain Dailler authored
      The snapshots using duplicate_ident_printer are there to avoid editing the
      printer during display of error.
      This also improves the error messages for transformation apply by adding
      an error exception.
      053bf85e
    • DAILLER Sylvain's avatar
      Merge branch '220_print' into 'master' · cc0497fd
      DAILLER Sylvain authored
      fix #220 : print for ind constr now only prints the constructor
      
      Closes #220
      
      See merge request !46
      cc0497fd
    • Raphael Rieu-Helft's avatar
      C extraction: cosmetic · 4fbbe883
      Raphael Rieu-Helft authored
      4fbbe883
    • Sylvain Dailler's avatar
      fix #220 : print for ind constr now only prints the constructor · e63363c9
      Sylvain Dailler authored
      Also, fix a problem of search on constructor
      e63363c9
    • MARCHE Claude's avatar
      fix version order · 9cb46b98
      MARCHE Claude authored
      9cb46b98
    • Sylvain Dailler's avatar
    • MARCHE Claude's avatar
      Put a more meaningful version on the master dev branch · a5596d5b
      MARCHE Claude authored
      1.2.0+git meaning 'the git dev master branch for upcoming release 1.2.0'
      
      Ideally, the name should contain the hash of the last commit, and
      the branch name. Is there any Make guru in the room?
      a5596d5b
    • Andrei Paskevich's avatar
      check for reference markers in illegal positions · 94b78115
      Andrei Paskevich authored
      Also, make let-functions with reference parameters
      inhibit auto-dereference in logic.
      94b78115
  2. 22 Oct, 2018 6 commits
  3. 21 Oct, 2018 2 commits
    • Andrei Paskevich's avatar
      examples/isqrt: use reference variables · 9ed5d019
      Andrei Paskevich authored
      9ed5d019
    • Andrei Paskevich's avatar
      WhyML: reference variables · 79f564bd
      Andrei Paskevich authored
      caveat: pass-as-reference does not work in chain relations.
              That is, 0 < r += 12 will not typecheck even
              if x is autodereferencing and (+=) has the
              first parameter with the reference marker.
      
      todo: forbid reference markers in logic, in type definitions,
            over logical symbols, etc.
      
      todo: update extraction drivers.
            why3.Ref.Ref defines
              - type "ref",
              - constructor "mk ref" (never used in Typing)
              - projection "contents" (both val and function)
              - program function "ref" (alias for "mk ref")
            ref.Ref defines
              - let-function (!)
              - program function (:=)
      
            It is important to attribute the symbols to their
            respective modules, since a program with reference
            variables may never use ref.Ref and why3.Ref.Ref
            is imported automatically.
      79f564bd
  4. 19 Oct, 2018 8 commits
  5. 18 Oct, 2018 4 commits
  6. 17 Oct, 2018 8 commits