diff options
| author | Jan Tuomi <jans.tuomi@gmail.com> | 2022-01-29 23:11:03 +0200 |
|---|---|---|
| committer | Jan Tuomi <jans.tuomi@gmail.com> | 2022-01-29 23:11:03 +0200 |
| commit | 649319b1dafb130801638c5a156e37d9e865ba5c (patch) | |
| tree | 7bc633565d87c3bbebc7c67f6bbda10db6c13f21 /src/ltypes.hs | |
| parent | 4d1a0eea5a433724764b4178d16fcb50d1c2b6bc (diff) | |
Implement strings as phrases of chars
Diffstat (limited to 'src/ltypes.hs')
| -rw-r--r-- | src/ltypes.hs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/ltypes.hs b/src/ltypes.hs new file mode 100644 index 0000000..bb7e0de --- /dev/null +++ b/src/ltypes.hs @@ -0,0 +1,24 @@ +module LTypes where + +import Utils + +data LWord + = LSymbol String + | LInteger Integer + | LFloat Double + | LBool Bool + | LChar Char + | LLabel String + | LStringLitRef String + | LPhrase [LWord] + deriving (Show, Eq) + +reprWord :: LWord -> String +reprWord (LSymbol a) = a +reprWord (LInteger a) = show a +reprWord (LFloat a) = show a +reprWord (LBool a) = show a +reprWord (LChar a) = show a +reprWord (LLabel a) = a +reprWord (LStringLitRef a) = "StrLit(" ++ a ++ ")" +reprWord (LPhrase a) = "P[ " ++ map reprWord a $> unwords ++ " ]" |
