language-ats 0.1.1.18 → 0.1.1.19
raw patch · 6 files changed
+39/−4 lines, 6 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- README.md +2/−2
- language-ats.cabal +1/−1
- src/Language/ATS/Parser.y +4/−1
- src/Language/ATS/PrettyPrint.hs +1/−0
- test/data/ats-generic.dats +16/−0
- test/data/ats-generic.out +15/−0
README.md view
@@ -5,5 +5,5 @@ [haskell-src-exts](http://hackage.haskell.org/package/haskell-src-exts) that provides a parser and pretty-printer for [ATS](http://ats-lang.org/). -The parser is buggy but it can handle a good subset of the language; check out-the `test/data` directory for some examples of what is supported.+The parser is buggy but it can handle a good subset of the language; see+the `test/data` directory for some examples of what is currently working.
language-ats.cabal view
@@ -1,5 +1,5 @@ name: language-ats-version: 0.1.1.18+version: 0.1.1.19 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
src/Language/ATS/Parser.y view
@@ -483,9 +483,11 @@ -- | Parse the details of an implementation Implementation : Universals FunName MaybeImplicit Universals openParen FullArgs closeParen eq Expression { Implement $5 $1 $3 $4 $2 $6 (Right $9) } | Universals FunName MaybeImplicit Universals doubleParens eq Expression { Implement $5 $1 $3 $4 $2 [] (Right $7) }+ | Universals FunName MaybeImplicit Universals eq Expression { Implement $5 $1 $3 $4 $2 [NoArgs] (Right $6) } StaticImplementation : Universals FunName MaybeImplicit Universals openParen FullArgs closeParen eq StaticExpression { Implement $5 $1 $3 $4 $2 $6 (Left $9) } | Universals FunName MaybeImplicit Universals doubleParens eq StaticExpression { Implement $5 $1 $3 $4 $2 [] (Left $7) }+ | Universals FunName MaybeImplicit Universals eq StaticExpression { Implement $5 $1 $3 $4 $2 [NoArgs] (Left $6) } -- | Parse a function name FunName : IdentifierOr { Unqualified $1 }@@ -701,11 +703,13 @@ ValDecl : val Pattern colon Type eq PreExpression { [ Val (get_addendum $1) (Just $4) $2 $6 ] } | val Pattern eq Expression { [ Val (get_addendum $1) Nothing $2 $4 ] } | ValDecl and Pattern eq Expression { Val None Nothing $3 $5 : $1 }+ | extern ValDecl { over _head (Extern $1) $2 } StaticDeclaration : prval Pattern eq Expression { PrVal $2 $4 } | praxi PreFunction { Func $1 (Praxi $2) } | primplmnt FunArgs StaticImplementation { ProofImpl $2 $3 } | StafunDecl { $1 }+ | extern StaticDeclaration { Extern $1 $2 } -- | Parse a declaration Declaration : include string { Include $2 }@@ -721,7 +725,6 @@ | staload dollar IdentifierOr { Staload (get_staload $1) Nothing ('$' : $3) } | staload dollar IdentifierOr eq string { Staload (get_staload $1) (Just ('$' : $3)) $5 } | staload IdentifierOr eq dollar IdentifierOr { Staload (get_staload $1) (Just $2) ('$' : $5) }- | extern Declaration { Extern $1 $2 } | var Pattern colon Type with PreExpression { Var (Just $4) $2 Nothing (Just $6) } -- FIXME signature is too general. | var Pattern colon Type eq PreExpression { Var (Just $4) $2 (Just $6) Nothing } | var Pattern eq Expression { Var Nothing $2 (Just $4) Nothing }
src/Language/ATS/PrettyPrint.hs view
@@ -346,6 +346,7 @@ instance Pretty Implementation where pretty (Implement _ [] is [] n [] e) = pretty n <> prettyOr is <+> "() =" <$> indent 2 (prettyImplExpr e)+ pretty (Implement _ [] is [] n NoA e) = pretty n <> prettyOr is <+> "=" <$> indent 2 (prettyImplExpr e) pretty (Implement _ [] is [] n ias e) = pretty n <> prettyOr is <+> prettyArgs ias <+> "=" <$> indent 2 (prettyImplExpr e) pretty (Implement _ [] is us n ias e) = pretty n <> prettyOr is <+> foldMap pretty us </> prettyArgs ias <+> "=" <$> indent 2 (prettyImplExpr e) pretty (Implement _ ps is [] n ias e) = foldMap pretty ps </> pretty n <> prettyOr is <+> prettyArgs ias <+> "=" <$> indent 2 (prettyImplExpr e)
+ test/data/ats-generic.dats view
@@ -0,0 +1,16 @@+#include "share/atspre_staload.hats"++#define ATS_MAINATSFLAG 1++staload UN = "prelude/SATS/unsafe.sats"++vtypedef boring_type = @{ first = int, second = int }++val return_boring_type: boring_type = @{ first = 12, second = 13 }++extern+val pass_boring_type : boring_type =+ "mac#"++implement pass_boring_type =+ return_boring_type
+ test/data/ats-generic.out view
@@ -0,0 +1,15 @@+#include "share/atspre_staload.hats"++#define ATS_MAINATSFLAG 1++staload UN = "prelude/SATS/unsafe.sats"++vtypedef boring_type = @{ first = int, second = int }++val return_boring_type: boring_type = @{ first = 12, second = 13 }++extern+val pass_boring_type: boring_type = "mac#"++implement pass_boring_type =+ return_boring_type