packages feed

language-ats 0.1.1.5 → 0.1.1.6

raw patch · 13 files changed

+326/−35 lines, 13 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

+ Language.ATS: [_typeCallArgs] :: Type -> [Type]
+ Language.ATS: [_typeCall] :: Type -> Name
+ Language.ATS: [implicits] :: Implementation -> [[Type]]
+ Language.ATS: typeCall :: Traversal' Type Name
+ Language.ATS: typeCallArgs :: Traversal' Type [Type]
- Language.ATS: FixityDecl :: Fixity -> (Maybe Int) -> [String] -> Declaration
+ Language.ATS: FixityDecl :: Fixity -> (Either String Int) -> [String] -> Declaration
- Language.ATS: Implement :: AlexPosn -> [Universal] -> [Universal] -> Name -> [Arg] -> Expression -> Implementation
+ Language.ATS: Implement :: AlexPosn -> [Universal] -> [[Type]] -> [Universal] -> Name -> [Arg] -> Expression -> Implementation

Files

language-ats.cabal view
@@ -1,5 +1,5 @@ name:                language-ats-version:             0.1.1.5+version:             0.1.1.6 synopsis:            Parser and pretty-printer for ATS. description:         Parser and pretty-printer for [ATS](http://www.ats-lang.org/), written with Happy and Alex. license:             BSD3@@ -75,7 +75,7 @@     ghc-options:       -Werror   if impl(ghc >= 8.0)     ghc-options:       -Wincomplete-uni-patterns -Wincomplete-record-updates -Wcompat-  ghc-options:         -threaded -rtsopts -with-rtsopts=-N -O3 -Wall+  ghc-options:         -Wall   default-language:    Haskell2010  source-repository head
src/Language/ATS.hs view
@@ -38,6 +38,8 @@                     -- * Lenses                     , leaves                     , constructorUniversals+                    , typeCall+                    , typeCallArgs                     ) where  import           Data.Maybe               (catMaybes)
src/Language/ATS/Lexer.x view
@@ -74,7 +74,8 @@  @if_block = "#if" ([^\#] | "#then" | "#print" | \n)+ "#endif" .* --- FIXME this is a disaster lol+-- Basically anything that can go inside implicit arguments, i.e. anything+-- necessary to construct a type. @ref_call = ($alpha | $digit | "(" | ")" | _ | (","))+ ">"  @not_close_c = \% [^\}]@@ -89,7 +90,9 @@  @at_brace = \@ ($white | @block_comment)* \{ -@operator = "**" | "+" | "-" | "*" | "/" | ".." | "!=" | ">=" | "<=" | "==" | "=" | "~" | "%" | "&&" | "||" | ":=" | ".<" | ">." | "<" | ">" | ">>" | "?" | "?!" | "#[" -- TODO context so tilde doesn't follow+-- TODO should be followed by a space; symbols like @..@ should have their own+-- thing.+@operator = "**" | "+" | "-" | "*" | "/" | ".." | "!=" | ">=" | "<=" | "==" | "=" | "~" | "%" | "&&" | "||" | ":=" | ".<" | ">." | "<" | ">" | ">>" | "?" | "?!" | "#[" | "->>"  @double_parens = "(" (@block_comment | $white+ | \n | "//".*)+ ")" | "()" @double_braces = "{" @block_comment "}" | "{}"@@ -103,8 +106,7 @@      $white+                  ;     ^ @block_comment         { tok (\p s -> CommentLex p s) }-    ^ "// end of".*          ;-    ^ "//".+                 { tok (\p s -> CommentLex p s) }+    ^ "//".*                 { tok (\p s -> CommentLex p s) }     "//".*                   ;     @block_comment           ;     "#define".*              { tok (\p s -> MacroBlock p s) }      @@ -136,8 +138,8 @@     case"-"                  { tok (\p s -> Keyword p (KwCase Minus)) }     case                     { tok (\p s -> Keyword p (KwCase None)) }     castfn                   { tok (\p s -> Keyword p KwCastfn) }-    val"+"                   { tok (\p s -> Keyword p (KwVal Plus)) } -- TODO also val@ ?-    val"-"                   { tok (\p s -> Keyword p (KwVal Minus)) } +    val"+"                   { tok (\p s -> Keyword p (KwVal Plus)) }+    val"-"                   { tok (\p s -> Keyword p (KwVal Minus)) }     val                      { tok (\p s -> Keyword p (KwVal None)) }     var                      { tok (\p s -> Keyword p KwVar) }     int                      { tok (\p s -> Keyword p KwInt) }@@ -216,8 +218,8 @@     @time_lit                { tok (\p s -> TimeTok p s) }     @integer                 { tok (\p s -> IntTok p (read s)) } -- FIXME shouldn't fail silenty on overflow     @float                   { tok (\p s -> FloatTok p (read s)) }-    $br / @ref_call          { tok (\p s -> SpecialBracket p) }     @at_brace                { tok (\p s -> Operator p "@{") } -- FIXME this is kinda sloppy+    $br / @ref_call          { tok (\p s -> SpecialBracket p) }     @operator                { tok (\p s -> Operator p s) }     @signature               { tok (\p s -> SignatureTok p (tail s)) }     $special                 { tok (\p s -> Special p s) }@@ -243,11 +245,12 @@               | Minus               deriving (Eq, Show, Generic, NFData, Data, Typeable) +-- TODO ideally we'd handle this as an internal error later in the parser. get_staload (Keyword _ (KwStaload b)) = b-get_staload _ = False+get_staload _ = undefined  get_addendum (Keyword _ (KwVal a)) = a-get_addendum _ = None+get_addendum _ = undefined  data Keyword = KwFun              | KwFnx@@ -463,7 +466,7 @@ to_string (CommentLex _ s) = s to_string (Identifier _ s) = s to_string (IdentifierSpace _ s) = s-to_string _ = mempty+to_string _ = undefined  token_posn (Identifier p _) = p token_posn (IdentifierSpace p _) = p
src/Language/ATS/Parser.y view
@@ -180,6 +180,7 @@     lspecial { SpecialBracket $$ }     atbrace { Operator $$ "@{" }     exp { Operator $$ "**" }+    stabby { Operator $$ "->>" }     mod { Keyword $$ KwMod }     fixAt { Keyword $$ KwFixAt }     lamAt { Keyword $$ KwLambdaAt }@@ -465,12 +466,12 @@               | { [] }  -- | Parse the details of an implementation-Implementation : FunName MaybeImplicit doubleParens eq Expression { Implement $3 [] [] $1 [] $5 } -- FIXME actually account for these somewhere-               | FunName MaybeImplicit openParen FullArgs closeParen eq Expression { Implement $3 [] [] $1 $4 $7 }-               | FunName MaybeImplicit Universals openParen FullArgs closeParen eq Expression { Implement $4 [] $3 $1 $5 $8 }-               | Universals FunName MaybeImplicit openParen FullArgs closeParen eq Expression { Implement $4 $1 [] $2 $5 $8 }-               | Universals FunName MaybeImplicit Universals openParen FullArgs closeParen eq Expression { Implement $5 $1 $4 $2 $6 $9 }-               | Universals FunName MaybeImplicit doubleParens eq Expression { Implement $4 $1 [] $2 [] $6 }+Implementation : FunName MaybeImplicit doubleParens eq Expression { Implement $3 [] $2 [] $1 [] $5 } -- FIXME actually account for these somewhere+               | FunName MaybeImplicit openParen FullArgs closeParen eq Expression { Implement $3 [] $2 [] $1 $4 $7 }+               | FunName MaybeImplicit Universals openParen FullArgs closeParen eq Expression { Implement $4 [] $2 $3 $1 $5 $8 }+               | Universals FunName MaybeImplicit openParen FullArgs closeParen eq Expression { Implement $4 $1 $3 [] $2 $5 $8 }+               | Universals FunName MaybeImplicit Universals openParen FullArgs closeParen eq Expression { Implement $5 $1 $3 $4 $2 $6 $9 }+               | Universals FunName MaybeImplicit doubleParens eq Expression { Implement $4 $1 $3 [] $2 [] $6 }  -- | Parse a function name FunName : IdentifierOr { Unqualified $1 }@@ -656,15 +657,18 @@          | stadef boolLit eq Name { Stadef (over _head toLower (show $2)) $4 [] } -- TODO identifierSpace          | sortdef IdentifierOr eq Type { SortDef $1 $2 $4 }          | AndSort { $1 }-         | vtypedef IdentifierOr eq Leaves {% Left $ Expected $3 "Type" "|" }+         | vtypedef IdentifierOr eq vbar {% Left $ Expected $3 "Type" "|" }  Fixity : infixr { RightFix $1 }        | infixl { LeftFix $1 }        | prefix { Pre $1 }        | postfix { Post $1 } +-- FIXME adopt a principled approach Operator : identifierSpace { to_string $1 }          | exp { "**" }+         | stabby { "->>" }+         | mutateArrow { "->" }  Operators : Operator { [$1] }           | Operators Operator { $2 : $1 }@@ -714,7 +718,8 @@             | symintr Name { SymIntr $1 $2 }             | stacst IdentifierOr colon Type OptExpression { Stacst $1 (Unqualified $2) $4 $5 }             | propdef IdentifierOr openParen Args closeParen eq Type { PropDef $1 $2 $4 $7 }-            | Fixity intLit Operators { FixityDecl $1 (Just $2) $3 }+            | Fixity intLit Operators { FixityDecl $1 (Right $2) $3 }+            | Fixity openParen Operator closeParen Operators { FixityDecl $1 (Left $3) $5 } -- FIXME             | val Universals IdentifierOr colon Type { StaVal $2 $3 $5 }             | lambda {% Left $ Expected $1 "Declaration" "lam" }             | llambda {% Left $ Expected $1 "Declaration" "llam" }@@ -740,4 +745,5 @@  parseError :: [Token] -> Either (ATSError String) a parseError = Left . Unknown . head + }
src/Language/ATS/PrettyPrint.hs view
@@ -317,7 +317,7 @@ instance Pretty Universal where     pretty (Universal [x@PrfArg{}] Nothing Nothing) = lbrace <+> pretty x <+> rbrace -- FIXME universals can now be length-one arguments     pretty (Universal [x] Nothing Nothing) = lbrace <> singleArg x <> rbrace -- FIXME universals can now be length-one arguments-    pretty (Universal bs ty Nothing) = lbrace <+> mconcat (punctuate ", " (fmap pretty (reverse bs))) <> gan ty <+> rbrace+    pretty (Universal bs ty Nothing) = lbrace <+> mconcat (punctuate ", " (fmap pretty (reverse bs))) <+> gan ty <> rbrace     pretty (Universal bs ty (Just e)) = lbrace <+> mconcat (punctuate ", " (fmap go (reverse bs))) <> gan ty <+> "|" <+> pretty e <+> rbrace         where go (Arg (First s))  = pretty s               go (Arg (Both s t)) = pretty s <+> colon <+> pretty t@@ -327,12 +327,16 @@ instance Pretty ATS where     pretty (ATS xs) = concatSame (fmap rewriteDecl xs) +prettyOr :: (Pretty a) => [[a]] -> Doc+prettyOr [] = mempty+prettyOr is = mconcat (fmap (prettyArgsU "<" ">") is)+ instance Pretty Implementation where-    pretty (Implement _ [] [] n [] e)  = "implement" <+> pretty n <+> "() =" <$> indent 2 (pretty e)-    pretty (Implement _ [] [] n ias e) = "implement" <+> pretty n <+> prettyArgs ias <+> "=" <$> indent 2 (pretty e)-    pretty (Implement _ [] us n ias e) = "implement" <+> pretty n <+> foldMap pretty us </> prettyArgs ias <+> "=" <$> indent 2 (pretty e)-    pretty (Implement _ ps [] n ias e) = "implement" <+> foldMap pretty ps </> pretty n <+> prettyArgs ias <+> "=" <$> indent 2 (pretty e)-    pretty (Implement _ ps us n ias e) = "implement" <+> foldMap pretty ps </> pretty n </> foldMap pretty us <+> prettyArgs ias <+> "=" <$> indent 2 (pretty e)+    pretty (Implement _ [] is [] n [] e)  = "implement" <+> pretty n <> prettyOr is <+> "() =" <$> indent 2 (pretty e)+    pretty (Implement _ [] is [] n ias e) = "implement" <+> pretty n <> prettyOr is <+> prettyArgs ias <+> "=" <$> indent 2 (pretty e)+    pretty (Implement _ [] is us n ias e) = "implement" <+> pretty n <> prettyOr is <+> foldMap pretty us </> prettyArgs ias <+> "=" <$> indent 2 (pretty e)+    pretty (Implement _ ps is [] n ias e) = "implement" <+> foldMap pretty ps </> pretty n <> prettyOr is <+> prettyArgs ias <+> "=" <$> indent 2 (pretty e)+    pretty (Implement _ ps is us n ias e) = "implement" <+> foldMap pretty ps </> pretty n <> prettyOr is </> foldMap pretty us <+> prettyArgs ias <+> "=" <$> indent 2 (pretty e)  isVal :: Declaration -> Bool isVal Val{}   = True@@ -396,10 +400,10 @@ prettyDL [DataPropLeaf [] e (Just e')]    = indent 2 ("|" <+> pretty e <+> "of" <+> pretty e') prettyDL (DataPropLeaf [] e Nothing:xs)   = prettyDL xs $$ indent 2 ("|" <+> pretty e) prettyDL (DataPropLeaf [] e (Just e'):xs) = prettyDL xs $$ indent 2 ("|" <+> pretty e <+> "of" <+> pretty e')-prettyDL [DataPropLeaf us e Nothing]      = indent 2 ("|" <+> foldMap pretty us <+> pretty e)-prettyDL [DataPropLeaf us e (Just e')]    = indent 2 ("|" <+> foldMap pretty us <+> pretty e <+> "of" <+> pretty e')-prettyDL (DataPropLeaf us e Nothing:xs)   = prettyDL xs $$ indent 2 ("|" <+> foldMap pretty us <+> pretty e)-prettyDL (DataPropLeaf us e (Just e'):xs) = prettyDL xs $$ indent 2 ("|" <+> foldMap pretty us <+> pretty e <+> "of" <+> pretty e')+prettyDL [DataPropLeaf us e Nothing]      = indent 2 ("|" <+> foldMap pretty (reverse us) <+> pretty e)+prettyDL [DataPropLeaf us e (Just e')]    = indent 2 ("|" <+> foldMap pretty (reverse us) <+> pretty e <+> "of" <+> pretty e')+prettyDL (DataPropLeaf us e Nothing:xs)   = prettyDL xs $$ indent 2 ("|" <+> foldMap pretty (reverse us) <+> pretty e)+prettyDL (DataPropLeaf us e (Just e'):xs) = prettyDL xs $$ indent 2 ("|" <+> foldMap pretty (reverse us) <+> pretty e <+> "of" <+> pretty e')  universalHelper :: [Universal] -> Doc universalHelper = mconcat . fmap pretty . reverse@@ -482,6 +486,12 @@     pretty (DataPropLeaf us e Nothing)   = "|" <+> foldMap pretty (reverse us) <+> pretty e     pretty (DataPropLeaf us e (Just e')) = "|" <+> foldMap pretty (reverse us) <+> pretty e <+> "of" <+> pretty e' +instance Pretty Fixity where+    pretty RightFix{} = "infixr"+    pretty LeftFix{}  = "infixl"+    pretty Pre{}      = "prefix"+    pretty Post{}     = "postfix"+ instance Pretty Declaration where     pretty (AbsType _ s as Nothing)        = "abstype" <+> text s <> prettyArgs as     pretty (AbsType _ s as (Just t))       = "abstype" <+> text s <> prettyArgs as <+> "=" <+> pretty t@@ -532,4 +542,6 @@     pretty (Stacst _ n t (Just e))         = "stacst" </> pretty n <+> ":" </> pretty t <+> "=" </> pretty e     pretty (PropDef _ s as t)              = "propdef" </> text s <+> prettyArgs as <+> "=" </> pretty t     pretty (Local _ d d')                  = "local" <$> indent 2 (pretty d) <$> "in" <$> indent 2 (pretty d') <$> "end"+    pretty (FixityDecl f (Left s) ss)      = pretty f <+> "(" <> text s <> ")" <+> hsep (fmap text ss)+    pretty (FixityDecl f (Right i) ss)     = pretty f <+> pretty i <+> hsep (fmap text ss)     pretty _                               = undefined
src/Language/ATS/Types.hs view
@@ -46,12 +46,13 @@     -- * Lenses     , leaves     , constructorUniversals+    , typeCall+    , typeCallArgs     ) where  import           Control.DeepSeq          (NFData) import           Control.Lens-import           Data.Functor.Foldable    (ListF (Cons), ana, cata, embed,-                                           project)+import           Data.Functor.Foldable    (ListF (Cons), ana, cata, embed, project) import           Data.Functor.Foldable.TH (makeBaseFunctor) import           Data.Maybe               (isJust) import           Data.Semigroup           (Semigroup)@@ -112,7 +113,7 @@                  | PropDef AlexPosn String [Arg] Type                  -- uses an 'Int' because you fully deserve what you get if your                  -- fixity declarations overflow.-                 | FixityDecl Fixity (Maybe Int) [String]+                 | FixityDecl Fixity (Either String Int) [String]                  deriving (Show, Eq, Generic, NFData)  data DataPropLeaf = DataPropLeaf [Universal] Expression (Maybe Expression)@@ -135,7 +136,7 @@           | Named Name           | Ex Existential Type           | ForA Universal Type-          | Dependent Name [Type]+          | Dependent { _typeCall :: Name, _typeCallArgs :: [Type] }           | Unconsumed Type -- !a           | AsProof Type (Maybe Type) -- a >> b           | FromVT Type -- For a viewtype VT, we can prove there exist a view V and type T such that `VT` is equivalent to `(V | T)` - that T is `VT?!`@@ -299,6 +300,7 @@ -- | An 'implement' declaration data Implementation = Implement { pos            :: AlexPosn                                 , preUniversalsI :: [Universal]+                                , implicits      :: [[Type]] -- ^ Implicit arguments                                 , universalsI    :: [Universal] -- ^ Universal quantifiers                                 , nameI          :: Name -- ^ Name of the template being implemented                                 , iArgs          :: [Arg] -- ^ Arguments@@ -342,6 +344,7 @@ makeBaseFunctor ''Type makeLenses ''Leaf makeLenses ''Declaration+makeLenses ''Type  rewriteDecl :: Declaration -> Declaration rewriteDecl x@SumViewType{} = g x
+ test/data/dirwalk.dats view
@@ -0,0 +1,109 @@+%{^+#ifdef ATS_MEMALLOC_GCBDW+#undef GC_H+#define GC_THREADS+#endif+%}++#include "prelude/DATS/filebas.dats"+#include "share/atspre_staload.hats"+#include "share/atspre_staload_libats_ML.hats"+#include "libats/libc/DATS/dirent.dats"+#include "libats/ML/DATS/filebas_dirent.dats"+#include "libats/DATS/athread_posix.dats"+#include "$PATSHOMELOCS/atscntrb-bucs320-divideconquerpar/mylibies.hats"+#include "$PATSHOMELOCS/atscntrb-bucs320-divideconquerpar/mydepies.hats"++#staload $DivideConquer+#staload $DivideConquerPar+#staload FWS = $FWORKSHOP_chanlst++assume input_t0ype = string+assume output_t0ype = int++typedef fworkshop = $FWS.fworkshop++fun as_char(s : string) : charNZ =+  $UN.ptr0_get<charNZ>(string2ptr(s))++fun dir_skipped(dir : string) : bool =+  case+ dir of+    | "." => true+    | ".." => true+    | _ when length(dir) > 0 => as_char(dir) = '.'+    | _ => false++fun DirWalk(fws : fworkshop, fname : string, fopr : cfun(string, int)) :+  int =+  let+    val () = $tempenver(fws)+    val () = $tempenver(fopr)+    +    implement DivideConquer$base_test<> (fname) =+      (test_file_isdir(fname) = 0)+    +    implement DivideConquer$base_solve<> (fname) =+      fopr(fname)+    +    implement DivideConquer$divide<> (dir) =+      (let+        var files = streamize_dirname_fname(dir)+        var files = stream_vt_filter_cloptr<string>( files+                                                   , lam (x) => ~dir_skipped(x)+                                                   )+        var files = stream_vt_map_cloptr<string><string>( files+                                                        , lam (file) =>+                                                            string_append3(dir, "/", file)+                                                        )+      in+        list0_of_list_vt(stream2list_vt(files))+      end)+    +    implement DivideConquer$conquer$combine<> (_, rs) =+      (list0_foldleft<int><int>(rs, 0, lam (res, r) => res + r))+    +    implement DivideConquerPar$fworkshop<> () =+      FWORKSHOP_chanlst(fws)+  in+    DivideConquer$solve<>(fname)+  end++fun wc_line(fname : string) : int =+  let+    fun lines(inp : FILEref) : int =+      let+        var stream = streamize_fileref_line(inp)+        var l = stream_vt_length(stream)+      in+        l+      end+    +    val opt = fileref_open_opt(fname, file_mode_r)+  in+    case+ opt of+      | ~None_vt() => (prerrln!("Cannot open the file: ", fname) ; 0)+      | ~Some_vt (inp) => let+        var nline = lines(inp)+      in+        (fileref_close(inp) ; nline)+      end+  end++#define NCPU 4++implement main0 (argc, argv) =+  {+    var fws = $FWS.fworkshop_create_exn()+    var added = $FWS.fworkshop_add_nworker(fws, NCPU)+    var root = (if argc >= 2 then+      argv[1]+    else+      ".") : string+    var nfile = DirWalk(fws, root, lam (fname) => let+                         var nline = wc_line(fname)+                         val _ = println!(fname, ": ", nline)+                       in+                         nline+                       end)+    val () = println!("Total number of lines:\n    ", nfile)+  }
+ test/data/dirwalk.out view
@@ -0,0 +1,109 @@+%{^+#ifdef ATS_MEMALLOC_GCBDW+#undef GC_H+#define GC_THREADS+#endif+%}++#include "prelude/DATS/filebas.dats"+#include "share/atspre_staload.hats"+#include "share/atspre_staload_libats_ML.hats"+#include "libats/libc/DATS/dirent.dats"+#include "libats/ML/DATS/filebas_dirent.dats"+#include "libats/DATS/athread_posix.dats"+#include "$PATSHOMELOCS/atscntrb-bucs320-divideconquerpar/mylibies.hats"+#include "$PATSHOMELOCS/atscntrb-bucs320-divideconquerpar/mydepies.hats"++#staload $DivideConquer+#staload $DivideConquerPar+#staload FWS = $FWORKSHOP_chanlst++assume input_t0ype = string+assume output_t0ype = int++typedef fworkshop = $FWS.fworkshop++fun as_char(s : string) : charNZ =+  $UN.ptr0_get<charNZ>(string2ptr(s))++fun dir_skipped(dir : string) : bool =+  case+ dir of+    | "." => true+    | ".." => true+    | _ when length(dir) > 0 => as_char(dir) = '.'+    | _ => false++fun DirWalk(fws : fworkshop, fname : string, fopr : cfun(string, int)) :+  int =+  let+    val () = $tempenver(fws)+    val () = $tempenver(fopr)+    +    implement DivideConquer$base_test<> (fname) =+      (test_file_isdir(fname) = 0)+    +    implement DivideConquer$base_solve<> (fname) =+      fopr(fname)+    +    implement DivideConquer$divide<> (dir) =+      (let+        var files = streamize_dirname_fname(dir)+        var files = stream_vt_filter_cloptr<string>( files+                                                   , lam (x) => ~dir_skipped(x)+                                                   )+        var files = stream_vt_map_cloptr<string><string>( files+                                                        , lam (file) =>+                                                            string_append3(dir, "/", file)+                                                        )+      in+        list0_of_list_vt(stream2list_vt(files))+      end)+    +    implement DivideConquer$conquer$combine<> (_, rs) =+      (list0_foldleft<int><int>(rs, 0, lam (res, r) => res + r))+    +    implement DivideConquerPar$fworkshop<> () =+      FWORKSHOP_chanlst(fws)+  in+    DivideConquer$solve<>(fname)+  end++fun wc_line(fname : string) : int =+  let+    fun lines(inp : FILEref) : int =+      let+        var stream = streamize_fileref_line(inp)+        var l = stream_vt_length(stream)+      in+        l+      end+    +    val opt = fileref_open_opt(fname, file_mode_r)+  in+    case+ opt of+      | ~None_vt() => (prerrln!("Cannot open the file: ", fname) ; 0)+      | ~Some_vt (inp) => let+        var nline = lines(inp)+      in+        (fileref_close(inp) ; nline)+      end+  end++#define NCPU 4++implement main0 (argc, argv) =+  {+    var fws = $FWS.fworkshop_create_exn()+    var added = $FWS.fworkshop_add_nworker(fws, NCPU)+    var root = (if argc >= 2 then+      argv[1]+    else+      ".") : string+    var nfile = DirWalk(fws, root, lam (fname) => let+                         var nline = wc_line(fname)+                         val _ = println!(fname, ": ", nline)+                       in+                         nline+                       end)+    val () = println!("Total number of lines:\n    ", nfile)+  }
test/data/fact.out view
@@ -24,6 +24,7 @@           loop(pf | n - 1, res)         end     +    // end of [loop]     var res: int with pf = 1     val () = loop(pf | n, addr@res)   in
+ test/data/mydepies.out view
@@ -0,0 +1,31 @@+(* ****** ****** *)+//+// HX-2017-02-05:+//+// Generic+// Divide-Conquer in parallel+//+(* ****** ****** *)+//+#include "$PATSHOMELOCS\+/atscntrb-hx-threadkit/mylibies.hats"++//+(* ****** ****** *)+//+#include "$PATSHOMELOCS\+/atscntrb-hx-fworkshop/mylibies.hats"++//+(* ****** ****** *)+//+local+  #define DIVIDECONQUER_CONT 1+in+  #include "$PATSHOMELOCS\+  /atscntrb-bucs320-divideconquer/mylibies.hats"+end++//+(* ****** ****** *)+(* end of [mydepies.hats] *)
+ test/data/mylibies.out view
@@ -0,0 +1,14 @@+(* ****** ****** *)+//+// HX-2017-02-05:+//+// Generic+// Divide-Conquer in parallel+//+(* ****** ****** *)+//+#staload DivideConquerPar = "./DATS/DivideConquerPar.dats"++//+(* ****** ****** *)+(* end of [mylibies.hats] *)
test/data/number-theory.out view
@@ -70,7 +70,7 @@  dataprop FACT(int, int) =   | FACTbas(0, 1)-  | { r, r1 : int }{n:nat} FACTind(n + 1, r) of (FACT(n, r1), MUL( n + 1+  | {n:nat}{ r, r1 : int } FACTind(n + 1, r) of (FACT(n, r1), MUL( n + 1                                                                  , r1                                                                  , r                                                                  ))
test/data/polyglot.out view
@@ -1048,6 +1048,7 @@   end  // Check shebang on scripts.+// // TODO flexible parser that drops spaces as appropriate // TODO check magic number so as to avoid checking shebang of binary file fun check_shebang(s : string) : pl_type =