Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
AVANZINI Martin
ecoimp
Commits
0bc972dc
Commit
0bc972dc
authored
May 09, 2020
by
AVANZINI Martin
Browse files
pretty printer bool expressions
parent
af1a19bf
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
examples/oopsla/absynth/polynomial/trader.pwhile
View file @
0bc972dc
def start():
var sPrice, minPrice, tick_z, numShares
tick_z = 0
var sPrice, minPrice, numShares
while 0<=minPrice and minPrice<sPrice:
prob(1,3):
...
...
@@ -11,5 +9,4 @@ def start():
numShares = unif(0,20)
while numShares>0:
numShares=numShares-1
tick_z=tick_z+sPrice
tick(tick_z)
tick(sPrice)
examples/oopsla/queueing-network.absynth
0 → 100644
View file @
0bc972dc
def qn ():
var l1, l2, n, i, tick_z
l1 = 0
l2 = 0
i = 0
while i <= n:
n = n - 1
if l1 > 0:
l1 = l1 - 1
if l2 > 0:
l2 = l2 - 1
prob (1,49):
prob(1,4):
l1 = l1 + 3
else:
prob(1,1):
l2 = l2 + 2
else:
l1 = l1 + 2
l2 = l2 + 1
if l1 >= l2:
tick_z = l1 + tick_z
else:
tick_z = l2 + tick_z
examples/oopsla/queueing-network.pwhile
0 → 100644
View file @
0bc972dc
def qn ():
var l1, l2, n, i, tick_z
l1 = 0
l2 = 0
i = 0
while i <= n:
n = n - 1
if l1 > 0:
l1 = l1 - 1
if l2 > 0:
l2 = l2 - 1
prob (1,49):
prob(1,4):
l1 = l1 + 3
else:
prob(1,1):
l2 = l2 + 2
else:
l1 = l1 + 2
l2 = l2 + 1
if l1 >= l2:
tick_z = l1 + tick_z
else:
tick_z = l2 + tick_z
results
View file @
0bc972dc
This diff is collapsed.
Click to expand it.
src/Data/PWhile/BoolExpression.hs
View file @
0bc972dc
...
...
@@ -147,10 +147,10 @@ variables g = S.unions [ E.variables a `S.union` E.variables b | (a :>=: b) <-
instance
PP
.
Pretty
p
=>
PP
.
Pretty
(
Literal
p
)
where
pretty
(
e1
:>=:
e2
)
=
PP
.
nest
2
(
PP
.
group
(
PP
.
pretty
e1
PP
.<
$
>
PP
.
nest
2
(
PP
.
group
(
PP
.
text
"≥"
PP
.<
$
>
PP
.
pretty
e2
)
)))
PP
.
group
(
PP
.
pretty
e1
)
PP
.<
/
>
PP
.
text
"≥"
PP
.<
+
>
PP
.
group
(
PP
.
pretty
e2
)
instance
PP
.
Pretty
l
=>
PP
.
Pretty
(
DNF
l
)
where
pretty
Top
=
PP
.
text
"⊤"
pretty
Bot
=
PP
.
text
"⊥"
pretty
dnf
=
lst
" ∨ "
[
lst
" ∧ "
[
PP
.
group
(
PP
.
pretty
l
)
|
l
<-
lits
c
]
|
c
<-
conjs
dnf
]
where
lst
s
=
PP
.
hcat
.
PP
.
punctuate
(
PP
.
text
s
)
where
lst
s
=
PP
.
fillSep
.
PP
.
punctuate
(
PP
.
text
s
)
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