From 2e594c0ef1af839a4e85139357c751f3140c1a8e Mon Sep 17 00:00:00 2001 From: Ramakrishnan Muthukrishnan Date: Sun, 28 Dec 2014 13:49:34 +0530 Subject: [PATCH] hw11: exercise 2 - spaces and ident --- hw11/SExpr.hs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hw11/SExpr.hs b/hw11/SExpr.hs index c3f7d70..b70683a 100644 --- a/hw11/SExpr.hs +++ b/hw11/SExpr.hs @@ -6,6 +6,7 @@ module SExpr where import AParser import Control.Applicative +import Data.Char(isSpace, isAlpha, isAlphaNum) ------------------------------------------------------------ -- 1. Parsing repetitions @@ -29,10 +30,10 @@ oneOrMore p = liftA2 (:) p (zeroOrMore p) ------------------------------------------------------------ spaces :: Parser String -spaces = undefined +spaces = zeroOrMore (satisfy isSpace) ident :: Parser String -ident = undefined +ident = liftA2 (:) (satisfy isAlpha) (zeroOrMore (satisfy isAlphaNum)) ------------------------------------------------------------ -- 3. Parsing S-expressions -- 2.37.2