1. 18 Mar, 2015 1 commit
  2. 18 Feb, 2015 1 commit
    • Kim Nguyễn's avatar
      Implement a safety-check to guarantee that recursive parametric types · 3aab1b01
      Kim Nguyễn authored
      remain regular. Within their recursive definitions, parametric types
      must always be instantiated with their original parameters and all
      types of mutually recursive definitions must have the same parameters.
      We use Tarjan's strongly connected components algorithm to group type definitions accordingly.
  3. 17 Feb, 2015 1 commit
  4. 16 Feb, 2015 5 commits
    • Kim Nguyễn's avatar
      Remove the a workaround the AST for patterns that was used to · 4f49a2af
      Kim Nguyễn authored
      correctly handle insantiated types in regular expressions.
    • Kim Nguyễn's avatar
      Add a warning when the lexer encounters the ambiguous ``[ 'a'a ]'' and · bcf40231
      Kim Nguyễn authored
      suggest to put a space before the second quote.
      Move the auxiliary 'warning' function from the typechecker to the
      Cduce_loc module.
      Re-indent some comments in ulexer.ml
    • Kim Nguyễn's avatar
      Fix the handling of polymorphic variables in the lexer. The solution · 36b83c45
      Kim Nguyễn authored
      to use two lexers (depending on whether we are between square brackets
      or not) is too brittle (it crudely tries to parse
       ``( [whitespace] 'a  [whitespace] )'' as a variable, to force the user
      to write the variable beetween parenthesis. However this does not scale
      to types with two arguments (says [ t ('a, 'b) ]).
      We use a simpler heuristic (with look ahead)
      (1) try to see if the regular expression
      ' (anything but ', \n)* '(anything but the first letter of an identifier)
      can be found. If so, we put back the lexeme in the buffer and parse it as as
      a string.
      (2) if (1) failed, try to parse it as a variable
      (3) if (3) failed, try to parse it again as a string. We are
      guaranteed to fail here but it means we have a malformed string, so we
      parse as a string to get a proper error message.
      The only thing this does not cover are cases like
      type t = [ 'abcd'Int ]
      which was tokenized before as [, 'abcd', Int, ]
      and is now tokenized as [, 'abcd, 'Int, ]
      It does not seem to be a problem in practice though (since in the code
      I have seen thus far, people were at least putting a space).
      it is easy to emmit a warning in this case, suggesting the user to add
      a whitespace to get the old behaviour back.
    • Kim Nguyễn's avatar
    • Kim Nguyễn's avatar
      Implement the syntax ``t (t1, …, tn)'' for type instantiation, without · 07bc7bc1
      Kim Nguyễn authored
      requiring an abscence of whitespace between ``t'' and ``(''.  Outside
      of regular expression contexts, ``t (t1, …, tn)'' is parsed with a
      higher precedence than & and \, to allow one to write
      ``t (Int) & Bool'' without extra parentheses (i.e.
      ``(t (Int)) & Bool'').  Inside a regular expression, type
      instantiation and sequencing become ambiguous, and there is no way to
      distinguish syntactically: ``[ Int (Int, Int) ]'' from
      ``[ t (Int, Int) ]''. The former should resolve to a sequence while
      the latter only makes sense as an instantiation (if ``t'' is a
      parametric type). Both are treated as element sequencing and
      disambiguated during identifier resolution (more precisely during the
      "derecurse" phase, before typechecking).
      Note that due to the lower precedence of sequencing w.r.t to other
      regular expression constructs, a type ``[ t (Int)* ]'' will be parsed
      correctly, but yield an error message saying that t is not fully
      intantiated. One has to write ``[ (t (Int))* ]'' which is similar to
      function applications for expressions.
      Finally, we also re-order sequencing after typing to always group a
      potential type instantiation with its argument, i.e. we transform
      sequences such as
      ``[ t1 t2 t3 ... tn ]'' (which are parsed as
      ``[ (((t1 t2) t3) ... tn) ]'' because sequence concatenation is
      left-associative) into ``[ ... (ti tj) ... ]'' if ``ti'' is an
      identifier and ``tj'' is of the form ``(s1,...,sk)''. This is sound
      because concatenation of regular expression is associative (and the
      original sequence would fail, anyway).
  5. 15 Feb, 2015 1 commit
  6. 14 Dec, 2014 1 commit
  7. 05 Oct, 2014 1 commit
  8. 19 Sep, 2014 1 commit
  9. 14 Sep, 2014 1 commit
  10. 12 Sep, 2014 2 commits
  11. 09 Sep, 2014 1 commit
    • Pietro Abate's avatar
      New syntax for parametric types · f1235de1
      Pietro Abate authored
      now we can write types as
      type t( 'a) = <a>'a
      and patterns can contain type instantiations
      let f = fun (t('a) -> [ t('a)* ]) x -> [ x ];;
      let id = fun (t(Int) -> [ t(Int)* ]) x -> [ x ];;
      Note: parametric types must be written as "IDENT(" without space.
  12. 08 Sep, 2014 3 commits
  13. 28 Aug, 2014 1 commit
    • Pietro Abate's avatar
      More var.ml cleanup · 737730a2
      Pietro Abate authored
      - Var identifiers are now of type U.t instead of string
      - Remove TVar from ast. Polymorphic variables are just types
  14. 25 Aug, 2014 2 commits
  15. 19 Aug, 2014 1 commit
  16. 23 Jul, 2014 1 commit
  17. 11 Jul, 2014 4 commits
  18. 10 Jul, 2014 1 commit
  19. 09 Jul, 2014 2 commits
  20. 08 Jul, 2014 1 commit
  21. 01 Jul, 2014 1 commit
  22. 27 Jun, 2014 1 commit
    • Julien Lopez's avatar
      We don't need parentheses for type variables in regexp anymore, the syntax is · 9b94eb11
      Julien Lopez authored
      now as such:
      	- ['a] is the regexp matching the type variable "a";
      	- ['a'] is the regexp matching the string "a";
      	- ['a' 'a] is the regexp matching the string "a" followed by the type
      	variable "a";
      	- ['a''a] is a syntax error (a string in single quotes in a regexp MUST
      	be followed by a character that cannot be the beginning of a name for a
      	type variable, a blank character will do).
      Bug: At this point, when using CDuce at toplevel, one will have to press enter
      twice when typing a regexp with type variables.
  23. 26 Jun, 2014 1 commit
  24. 24 Jun, 2014 1 commit
  25. 23 Jun, 2014 1 commit
  26. 22 Jun, 2014 1 commit
  27. 20 Jun, 2014 1 commit
  28. 19 Jun, 2014 1 commit