diff options
author | Camil Staps | 2017-08-13 19:21:43 +0200 |
---|---|---|
committer | Camil Staps | 2017-08-13 19:21:48 +0200 |
commit | bb762e08e950b4d6d16bf0782c3e8d689f28c5dc (patch) | |
tree | c01e0dbca3b9761a4fcadcfc34c15d4b5a0a0193 /Sil | |
parent | cleanup (diff) |
Improved compiler interface (#8)
Specifically:
- --check, --compile and --generate are implicit, there are --no-*
options to disable.
- --help added.
- --run removed.
- Renamed to silc (sil compiler).
- Output files are relative to input file.
Diffstat (limited to 'Sil')
-rw-r--r-- | Sil/Util/Parser.dcl | 1 | ||||
-rw-r--r-- | Sil/Util/Parser.icl | 5 |
2 files changed, 5 insertions, 1 deletions
diff --git a/Sil/Util/Parser.dcl b/Sil/Util/Parser.dcl index 14dc022..e0046fa 100644 --- a/Sil/Util/Parser.dcl +++ b/Sil/Util/Parser.dcl @@ -47,6 +47,7 @@ satisfy :: (a -> Bool) -> Parser a a check :: (a -> Bool) -> Parser a a (until) infix 2 :: (Parser a b) (Parser a c) -> Parser a [b] item :: a -> Parser a a | ==, name, toString a +anyItem :: ([a] -> Parser a a) | ==, name, toString a list :: [a] -> Parser a [a] | ==, name, toString a seplist :: a (Parser a b) -> Parser a [b] | ==, name, toString a seplistUntil :: a a (Parser a b) -> Parser a [b] | ==, name, toString a diff --git a/Sil/Util/Parser.icl b/Sil/Util/Parser.icl index e730313..154a989 100644 --- a/Sil/Util/Parser.icl +++ b/Sil/Util/Parser.icl @@ -1,6 +1,6 @@ implementation module Sil.Util.Parser -from StdFunc import iter +from StdFunc import iter, o import StdList import StdOverloaded @@ -140,6 +140,9 @@ where item :: a -> Parser a a | ==, name, toString a item a = satisfy ((==) a) <#> name a +anyItem :: ([a] -> Parser a a) | ==, name, toString a +anyItem = foldr (<|>) empty o map item + list :: [a] -> Parser a [a] | ==, name, toString a list as = mapM item as |