• R/O
  • HTTP
  • SSH
  • HTTPS

tutorial: Commit

This repository is for tutorials of Eos.


Commit MetaInfo

Revision84962245aa0a65df7f1928df880f05b682bb1f33 (tree)
Time2015-01-22 09:50:55
Authorkinoshita-eos <kinoshita@yasu...>
Commiterkinoshita-eos

Log Message

Add: PIONE tutorial of Loop Statement with constraint or sequence.
new file: SampleCode/PIONE/Basic11/EvenOddLoop3.pione
new file: SampleCode/PIONE/Basic11/LoopTouch3.pione
new file: SampleCode/PIONE/Basic11/LoopTouch4.pione

Add: PIONE tutorial of if Statement for Debug.
new file: SampleCode/PIONE/Basic7/ForDebug.pione
new file: SampleCode/PIONE/Basic7/input/1.txt
new file: SampleCode/PIONE/Basic7/input/2.txt

Change Summary

Incremental Difference

--- /dev/null
+++ b/SampleCode/PIONE/Basic11/EvenOddLoop3.pione
@@ -0,0 +1,42 @@
1+param $maxval := 456
2+param $minval := 123
3+param $dval := 37
4+
5+Rule Main
6+ output '*.txt'.all
7+Flow
8+ rule LoopSystem {val: $minval}
9+End
10+
11+Rule LoopSystem
12+ output '*.txt'.all
13+ param $val
14+ constraint $val <= $maxval
15+Flow
16+ rule EvenOdd {val: $val}
17+ rule LoopSystem {val: (($val * 2) - $minval) + ($dval * (1|2))}
18+End
19+
20+Rule EvenOdd
21+ output '*.txt'
22+ param $val
23+Flow
24+ if $val % 2 == 0
25+ rule Even {val: $val}
26+ else
27+ rule Odd {val: $val}
28+ end
29+End
30+
31+Rule Even
32+ output '*.txt'
33+ param $val
34+Action
35+ echo "{$val} is even." >> Even{$val}.txt;
36+End
37+
38+Rule Odd
39+ output '*.txt'
40+Action
41+ echo "{$val} is odd." >> Odd{$val}.txt;
42+End
\ No newline at end of file
--- /dev/null
+++ b/SampleCode/PIONE/Basic11/LoopTouch3.pione
@@ -0,0 +1,24 @@
1+param $max := 64
2+
3+Rule Main
4+ output '*.txt'
5+Flow
6+ rule LoopSystem {val: 0}
7+End
8+
9+Rule LoopSystem
10+ output '*.txt'
11+ param $val
12+ constraint $val <= $max
13+Flow
14+ rule Test {val: $val}
15+ rule LoopSystem {val: ($val * 2) + 1}
16+ rule LoopSystem {val: ($val * 2) + 2}
17+End
18+
19+Rule Test
20+ output '{$val}.txt'
21+ param $val
22+Action
23+ touch {$O[1]}
24+End
\ No newline at end of file
--- /dev/null
+++ b/SampleCode/PIONE/Basic11/LoopTouch4.pione
@@ -0,0 +1,23 @@
1+param $max := 64
2+
3+Rule Main
4+ output '*.txt'
5+Flow
6+ rule LoopSystem {val: 0}
7+End
8+
9+Rule LoopSystem
10+ output '*.txt'
11+ param $val
12+ constraint $val <= $max
13+Flow
14+ rule Test {val: $val}
15+ rule LoopSystem {val: ($val * 2) + (1|2)}
16+End
17+
18+Rule Test
19+ output '{$val}.txt'
20+ param $val
21+Action
22+ touch {$O[1]}
23+End
\ No newline at end of file
--- /dev/null
+++ b/SampleCode/PIONE/Basic7/ForDebug.pione
@@ -0,0 +1,43 @@
1+$LogFlag := false
2+$LogFile := '{$I[1][1]}.log'
3+
4+Rule Main
5+ input '*.txt'
6+ output '{$I[1][1]}.out'
7+ if $LogFlag
8+ output $LogFile
9+ end
10+Flow
11+ rule Sub1
12+End
13+
14+Rule Sub1
15+ input '*.txt'
16+ output '{$I[1][1]}.out'
17+ if $LogFlag
18+ output $LogFile
19+ end
20+Flow
21+ rule Sub2
22+End
23+
24+Rule Sub2
25+ input '*.txt'
26+ output '{$I[1][1]}.out'
27+ if $LogFlag
28+ output $LogFile
29+ end
30+Flow
31+ rule Sub3
32+End
33+
34+Rule Sub3
35+ input '*.txt'
36+ output '{$I[1][1]}.out'
37+ output $LogFile
38+Action
39+ touch {$O[1]}
40+ if [ {$LogFlag} ] ; then
41+ wc {$I[1]} > {$O[2]}
42+ fi
43+End
\ No newline at end of file
--- /dev/null
+++ b/SampleCode/PIONE/Basic7/input/1.txt
@@ -0,0 +1,5 @@
1+1234
2+56789
3+0qwe
4+rt
5+y
--- /dev/null
+++ b/SampleCode/PIONE/Basic7/input/2.txt
@@ -0,0 +1,3 @@
1+!!!!!!!!!!!!!!!!!
2+DDDDDDDDDDDDDDDDD
3+!!!!!!!!!!!!!!!!!
Show on old repository browser