Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
i7
peregrine
Commits
ebce00a0
Commit
ebce00a0
authored
Aug 08, 2018
by
Philipp Meyer
Browse files
Remove division and multiplication operators
parent
2deed1ec
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/Parser/PP.hs
View file @
ebce00a0
...
...
@@ -84,7 +84,7 @@ prefix name fun = Prefix ( reservedOp name *> return fun )
termOperatorTable
::
[[
Operator
String
()
Identity
(
Term
String
)]]
termOperatorTable
=
[
[
prefix
"-"
Minus
]
,
[
binary
"*"
(
:*:
)
AssocLeft
,
binary
"/"
(
:/:
)
AssocLeft
,
binary
"%"
(
:%:
)
AssocLeft
]
,
[
binary
"*"
(
:*:
)
AssocLeft
]
,
[
binary
"+"
(
:+:
)
AssocLeft
,
binary
"-"
(
:-:
)
AssocLeft
]
]
...
...
src/Property.hs
View file @
ebce00a0
...
...
@@ -22,8 +22,6 @@ data Term a =
|
Term
a
:+:
Term
a
|
Term
a
:-:
Term
a
|
Term
a
:*:
Term
a
|
Term
a
:/:
Term
a
-- integer division truncated toward negative infinity
|
Term
a
:%:
Term
a
-- integer modulos, satisfying (x / y)*y + (x % y) = x
deriving
(
Eq
)
instance
(
Show
a
)
=>
Show
(
Term
a
)
where
...
...
@@ -33,8 +31,6 @@ instance (Show a) => Show (Term a) where
show
(
t
:+:
u
)
=
"("
++
show
t
++
" + "
++
show
u
++
")"
show
(
t
:-:
u
)
=
"("
++
show
t
++
" - "
++
show
u
++
")"
show
(
t
:*:
u
)
=
show
t
++
" * "
++
show
u
show
(
t
:/:
u
)
=
show
t
++
" / "
++
show
u
show
(
t
:%:
u
)
=
show
t
++
" % "
++
show
u
instance
Functor
Term
where
fmap
f
(
Var
x
)
=
Var
(
f
x
)
...
...
@@ -43,8 +39,6 @@ instance Functor Term where
fmap
f
(
t
:+:
u
)
=
fmap
f
t
:+:
fmap
f
u
fmap
f
(
t
:-:
u
)
=
fmap
f
t
:-:
fmap
f
u
fmap
f
(
t
:*:
u
)
=
fmap
f
t
:*:
fmap
f
u
fmap
f
(
t
:/:
u
)
=
fmap
f
t
:/:
fmap
f
u
fmap
f
(
t
:%:
u
)
=
fmap
f
t
:%:
fmap
f
u
data
Op
=
Gt
|
Ge
|
Eq
|
Ne
|
Le
|
Lt
|
ModEq
Integer
|
ModNe
Integer
deriving
(
Eq
)
...
...
src/Solver/Formula.hs
View file @
ebce00a0
...
...
@@ -15,8 +15,6 @@ evaluateTerm (Minus t) m = - evaluateTerm t m
evaluateTerm
(
t
:+:
u
)
m
=
evaluateTerm
t
m
+
evaluateTerm
u
m
evaluateTerm
(
t
:-:
u
)
m
=
evaluateTerm
t
m
-
evaluateTerm
u
m
evaluateTerm
(
t
:*:
u
)
m
=
evaluateTerm
t
m
*
evaluateTerm
u
m
evaluateTerm
(
t
:/:
u
)
m
=
(
evaluateTerm
t
m
)
`
sDiv
`
(
evaluateTerm
u
m
)
evaluateTerm
(
t
:%:
u
)
m
=
(
evaluateTerm
t
m
)
`
sMod
`
(
evaluateTerm
u
m
)
opToFunction
::
Op
->
SInteger
->
SInteger
->
SBool
opToFunction
Gt
=
(
.>
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment