From bad32a12573bf14968746ea9ad0f6c4f20b50cf1 Mon Sep 17 00:00:00 2001 From: Matthew Hall Date: Wed, 22 Feb 2023 22:23:35 +1300 Subject: Re-work program structure, MAIN entrypoint + only PROC definitions --- DSL/Parsing.hs | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) (limited to 'DSL/Parsing.hs') diff --git a/DSL/Parsing.hs b/DSL/Parsing.hs index 72d6b23..d4d1253 100644 --- a/DSL/Parsing.hs +++ b/DSL/Parsing.hs @@ -191,16 +191,8 @@ blockP = firstOf [ whileP , linearP ] -programP :: DSLParser ([ProcSpec], Program) -programP = phrase $ procs `plus` code +stringToProgram :: String -> Maybe ProcTable +stringToProgram = (>>=buildProcTable . snd) . parse (tokenizer `chain` program) where - procs = mult procP - code = mult1 blockP - -stringToProgram :: String -> Maybe (ProcTable, Program) -stringToProgram = (>>=(f . snd)) . parse (tokenizer `chain` programP) - where - f (ps, b) = case buildProcTable ps of - Nothing -> Nothing - Just t -> Just (t, b) + program = phrase $ mult procP -- cgit v1.2.1