diff options
| author | Matthew Hall <hallmatthew314@gmail.com> | 2023-02-22 22:23:35 +1300 |
|---|---|---|
| committer | Matthew Hall <hallmatthew314@gmail.com> | 2023-02-22 22:24:29 +1300 |
| commit | bad32a12573bf14968746ea9ad0f6c4f20b50cf1 (patch) | |
| tree | 26ce098f30f054b2f2a742d2c06b857951ea68db /DSL/Parsing.hs | |
| parent | 0bde837174fcb9c17cb3adbf6bc3c7407cab10df (diff) | |
Re-work program structure, MAIN entrypoint + only PROC definitions
Diffstat (limited to 'DSL/Parsing.hs')
| -rw-r--r-- | DSL/Parsing.hs | 14 |
1 files changed, 3 insertions, 11 deletions
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 |
