Skip to content
Snippets Groups Projects
Commit c69a3807 authored by mnay1u19's avatar mnay1u19
Browse files

union,intersection,concat,startswith,difference, isSublist have been added to lexer and paser files

parent 69416607
Branches newSematics
No related tags found
No related merge requests found
...@@ -53,6 +53,13 @@ $digit+ {\p s -> TokenNat p (read s) } ...@@ -53,6 +53,13 @@ $digit+ {\p s -> TokenNat p (read s) }
\"[$alpha $digit]+\" {\p s -> TokenString p (init.tail $ s) } \"[$alpha $digit]+\" {\p s -> TokenString p (init.tail $ s) }
AND {\p s -> TokenBoolAND p } AND {\p s -> TokenBoolAND p }
OR {\p s -> TokenBoolOR p } OR {\p s -> TokenBoolOR p }
isSublist {\p s -> TokenIsSubList p }
startswith {\p s -> TokenStartsWith p }
concat {\p s -> TokenConcat p }
union {\p s -> TokenUnion p }
i'section {\p s -> TokenISection p }
difference {\p s -> TokenDifference p }
{ {
...@@ -94,7 +101,13 @@ data Token = ...@@ -94,7 +101,13 @@ data Token =
TokenThen AlexPosn | TokenThen AlexPosn |
TokenEqual AlexPosn | TokenEqual AlexPosn |
TokenBoolAND AlexPosn | TokenBoolAND AlexPosn |
TokenBoolOR AlexPosn TokenBoolOR AlexPosn |
TokenIsSubList AlexPosn |
TokenConcat AlexPosn |
TokenStartsWith AlexPosn |
TokenUnion AlexPosn |
TokenISection AlexPosn |
TokenDifference AlexPosn
deriving (Eq, Show) deriving (Eq, Show)
...@@ -135,4 +148,10 @@ pos token = case token of ...@@ -135,4 +148,10 @@ pos token = case token of
(TokenIf p) -> p (TokenIf p) -> p
(TokenThen p) -> p (TokenThen p) -> p
(TokenEqual p) -> p (TokenEqual p) -> p
(TokenIsSubList p) -> p
(TokenStartsWith p) -> p
(TokenConcat p) -> p
(TokenUnion p) -> p
(TokenISection p) -> p
(TokenDifference p) -> p
} }
\ No newline at end of file
...@@ -39,11 +39,7 @@ import CSV ...@@ -39,11 +39,7 @@ import CSV
x { TokenXProduct _ } x { TokenXProduct _ }
map { TokenMap _ } map { TokenMap _ }
xx { TokenXXProduct _ } xx { TokenXXProduct _ }
-- mapr { TokenMapr _ }
-- '!' { TokenNot _ }
-- zip { TokenZip _ }
contains { TokenContains _ } contains { TokenContains _ }
-- isSubstring { TokenIsSubstring _ }
isEmpty { TokenIsEmpty _ } isEmpty { TokenIsEmpty _ }
let { TokenLet _} let { TokenLet _}
if { TokenIf _} if { TokenIf _}
...@@ -52,6 +48,17 @@ import CSV ...@@ -52,6 +48,17 @@ import CSV
'=' { TokenEqual _} '=' { TokenEqual _}
or { TokenBoolAND _ } or { TokenBoolAND _ }
and { TokenBoolOR _ } and { TokenBoolOR _ }
isSublist {TokenIsSubList _ }
startswith {TokenStartsWith _}
concat {TokenConcat _ }
union {TokenUnion _ }
i'section {TokenISection _ }
difference {TokenDifference _ }
-- isSubstring { TokenIsSubstring _ }
-- zip { TokenZip _ }
-- mapr { TokenMapr _ }
-- '!' { TokenNot _ }
%left FUNCCALL %left FUNCCALL
...@@ -90,6 +97,16 @@ Expr : ...@@ -90,6 +97,16 @@ Expr :
| PredefFunc {PredefFunc $1} | PredefFunc {PredefFunc $1}
| Expr or Expr {FuncCall (PredefFunc Or) [] [$1,$3]} | Expr or Expr {FuncCall (PredefFunc Or) [] [$1,$3]}
| Expr and Expr {FuncCall (PredefFunc And) [] [$1,$3]} | Expr and Expr {FuncCall (PredefFunc And) [] [$1,$3]}
| isSublist dType dType {FuncCall (PredefFunc isSublist) [] [$2,$3]}
| startswith dType dType {FuncCall (PredefFunc startswith) [] [$2,$3]}
| concat dType dType {FuncCall (PredefFunc concat) [] [$2,$3]}
| union dType dType {FuncCall (PredefFunc union) [] [$2,$3]}
| i'section dType dType {FuncCall (PredefFunc i'section) [] [$2,$3]}
| difference dType dType {FuncCall (PredefFunc difference) [] [$2,$3]}
dType :: record {Record}
| Str {String $1}
PredefFunc : isEmpty {IsEmpty} PredefFunc : isEmpty {IsEmpty}
| filter {Filter} | filter {Filter}
...@@ -98,6 +115,12 @@ PredefFunc : isEmpty {IsEmpty} ...@@ -98,6 +115,12 @@ PredefFunc : isEmpty {IsEmpty}
| map {Map} | map {Map}
| and {And} | and {And}
| or {Or} | or {Or}
| isSublist {isSublist}
| startswith {startswith}
| concat {concat}
| union {union}
| i'section {i'section}
| difference {difference}
-- | zip {Zip} -- | zip {Zip}
-- | Mapr -- | Mapr
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment