emfrp 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/emfrp/compile/c/monofy.rb +5 -3
- data/lib/emfrp/compile/c/syntax_exp_codegen.rb +2 -2
- data/lib/emfrp/parser/newnode_convert.rb +1 -1
- data/lib/emfrp/parser/parser.rb +4 -4
- data/lib/emfrp/version.rb +1 -1
- data/tests/compiler/AtlastDependency/AtlastDependency.mfrp +7 -0
- data/tests/compiler/AtlastDependency/AtlastDependencyMain.c +19 -0
- data/tests/compiler/AtlastDependency/Rakefile +2 -0
- data/tests/compiler/AtlastDependency/actual_out.txt +10 -0
- data/tests/compiler/AtlastDependency/expected_out.txt +10 -0
- data/tests/compiler/AtlastDependency/in.txt +0 -0
- data/tests/compiler/NestedMatch/NestedMatch.mfrp +29 -0
- data/tests/compiler/NestedMatch/NestedMatchMain.c +20 -0
- data/tests/compiler/NestedMatch/Rakefile +2 -0
- data/tests/compiler/NestedMatch/actual_out.txt +10 -0
- data/tests/compiler/NestedMatch/expected_out.txt +10 -0
- data/tests/compiler/NestedMatch/in.txt +10 -0
- data/tests/compiler/SubModuleInit/Delay2.mfrp +7 -0
- data/tests/compiler/SubModuleInit/Rakefile +2 -0
- data/tests/compiler/SubModuleInit/SubModuleInit.mfrp +7 -0
- data/tests/compiler/SubModuleInit/SubModuleInitMain.c +17 -0
- data/tests/compiler/SubModuleInit/actual_out.txt +10 -0
- data/tests/compiler/SubModuleInit/expected_out.txt +10 -0
- data/tests/compiler/SubModuleInit/in.txt +10 -0
- metadata +22 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b22236346a774cffb9cf18b119085b0177a0aab6
|
4
|
+
data.tar.gz: f0aeb3ec0dd857f2ba08678f0a34b8398bd529a9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bbbbb76bac2428193c34ce526269dfa8d524116de18f419a6d1536809eb655449e3f7c186511ea99bad08fca175a7c501092bb05381a6e4c7b3a5812b3534610
|
7
|
+
data.tar.gz: 29135f70e0b9607465857decad838a735ef00dd93db938a1b5b98dc17b53af31eeaaff244be759578ad06dc9704373bcf435c374c5abea53f00dec8e9bcefeec
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'set'
|
2
|
+
|
1
3
|
module Emfrp
|
2
4
|
class Monofy
|
3
5
|
IType = Struct.new(:typing, :type_def) do
|
@@ -32,14 +34,14 @@ module Emfrp
|
|
32
34
|
|
33
35
|
def used_nodes
|
34
36
|
used = []
|
37
|
+
visited = Set.new
|
35
38
|
f = proc do |n|
|
36
39
|
used << n
|
40
|
+
visited << n[:name]
|
37
41
|
n[:params].each do |p|
|
38
42
|
pn = @top[:dict][:node_space][p[:name][:desc]].get
|
39
43
|
if pn.is_a?(NodeDef)
|
40
|
-
if p[:
|
41
|
-
used << pn
|
42
|
-
else
|
44
|
+
if !visited.include?(p[:name])
|
43
45
|
f.call(pn)
|
44
46
|
end
|
45
47
|
end
|
@@ -55,7 +55,7 @@ module Emfrp
|
|
55
55
|
stmts << "#{ct.tref(self)} #{vname};"
|
56
56
|
left = self[:exp]
|
57
57
|
if left.is_a?(VarRef)
|
58
|
-
left_vname =
|
58
|
+
left_vname = left[:binder].get.var_name(ct, left[:name][:desc])
|
59
59
|
else
|
60
60
|
left_vname = "_tmp%03d" % ct.uniq_id_gen
|
61
61
|
stmts.unshift "#{ct.tref(left)} #{left_vname};"
|
@@ -94,7 +94,7 @@ module Emfrp
|
|
94
94
|
if type_def.enum?(ct)
|
95
95
|
conds << "#{receiver} == #{tvalue_id}"
|
96
96
|
else
|
97
|
-
conds << "#{receiver}" + accessor + "
|
97
|
+
conds << "#{receiver}" + accessor + "tvalue_id == " + tvalue_id.to_s
|
98
98
|
end
|
99
99
|
end
|
100
100
|
new_receiver = "#{receiver}" + accessor + "value." + pattern[:name][:desc]
|
data/lib/emfrp/parser/parser.rb
CHANGED
@@ -56,14 +56,14 @@ module Emfrp
|
|
56
56
|
width = lines[ln].chars.take_while{|c| c == "\s"}.size
|
57
57
|
((ln+1)..(len-1)).each do |ln2|
|
58
58
|
width2 = lines[ln2].chars.take_while{|c| c == "\s"}.size
|
59
|
-
if
|
59
|
+
if ln2 == len - 1
|
60
|
+
lines[ln2] << " :endcase"
|
61
|
+
break
|
62
|
+
elsif lines[ln2].strip == ""
|
60
63
|
next
|
61
64
|
elsif width2 <= width
|
62
65
|
lines[ln2 - 1] << " :endcase"
|
63
66
|
break
|
64
|
-
elsif ln2 == len - 1
|
65
|
-
lines[ln2] << " :endcase"
|
66
|
-
break
|
67
67
|
end
|
68
68
|
end
|
69
69
|
end
|
data/lib/emfrp/version.rb
CHANGED
@@ -0,0 +1,19 @@
|
|
1
|
+
#include "AtlastDependency.h"
|
2
|
+
#include <stdio.h>
|
3
|
+
#include <stdlib.h>
|
4
|
+
|
5
|
+
int i = 0;
|
6
|
+
|
7
|
+
void Input() {
|
8
|
+
}
|
9
|
+
|
10
|
+
void Output(int* delay3A) {
|
11
|
+
printf("%d\n", *delay3A);
|
12
|
+
if (++i == 10) {
|
13
|
+
exit(0);
|
14
|
+
}
|
15
|
+
}
|
16
|
+
|
17
|
+
int main() {
|
18
|
+
ActivateAtlastDependency();
|
19
|
+
}
|
File without changes
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module NestedMatch
|
2
|
+
in tag : Int, value : Int
|
3
|
+
out x
|
4
|
+
use Std
|
5
|
+
|
6
|
+
type Tag = T1 | T21 | T22 | T33 | T34
|
7
|
+
type InnerA = Inner1(Int) | Inner2(Int,Int)
|
8
|
+
type InnerB = Inner3(Int) | Inner4(Int,Int)
|
9
|
+
type Outer = Outer1(Int) | Outer2(InnerA) | Outer3(InnerB)
|
10
|
+
|
11
|
+
node mid =
|
12
|
+
tag of:
|
13
|
+
0 -> Outer1(value)
|
14
|
+
1 -> Outer2(Inner1(value))
|
15
|
+
2 -> Outer2(Inner2(value,0))
|
16
|
+
3 -> Outer3(Inner3(value))
|
17
|
+
4 -> Outer3(Inner4(value,0))
|
18
|
+
_ -> Outer1(-1)
|
19
|
+
|
20
|
+
node x =
|
21
|
+
mid of:
|
22
|
+
Outer1(a) -> a
|
23
|
+
Outer2(innerA) -> innerA of:
|
24
|
+
Inner1(a) -> a
|
25
|
+
Inner2(a, _) -> a
|
26
|
+
Outer3(innerB) -> innerB of:
|
27
|
+
Inner3(a) -> a
|
28
|
+
Inner4(a, _) -> a
|
29
|
+
|
@@ -0,0 +1,20 @@
|
|
1
|
+
#include "NestedMatch.h"
|
2
|
+
#include <stdio.h>
|
3
|
+
#include <stdlib.h>
|
4
|
+
|
5
|
+
void Input(int* tag, int* value) {
|
6
|
+
static int counter = 0;
|
7
|
+
*tag = counter;
|
8
|
+
counter = (counter + 1) % 5;
|
9
|
+
if (scanf("%d", value) == EOF) {
|
10
|
+
exit(0);
|
11
|
+
}
|
12
|
+
}
|
13
|
+
|
14
|
+
void Output(int* x) {
|
15
|
+
printf("%d\n", *x);
|
16
|
+
}
|
17
|
+
|
18
|
+
int main() {
|
19
|
+
ActivateNestedMatch();
|
20
|
+
}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
#include "SubModuleInit.h"
|
2
|
+
#include <stdio.h>
|
3
|
+
#include <stdlib.h>
|
4
|
+
|
5
|
+
void Input(int* x, int* y) {
|
6
|
+
if (scanf("%d %d", x, y) == EOF) {
|
7
|
+
exit(0);
|
8
|
+
}
|
9
|
+
}
|
10
|
+
|
11
|
+
void Output(int* delay2X, int* delay2Y) {
|
12
|
+
printf("%d %d\n", *delay2X, *delay2Y);
|
13
|
+
}
|
14
|
+
|
15
|
+
int main() {
|
16
|
+
ActivateSubModuleInit();
|
17
|
+
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: emfrp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kensuke Sawada
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-06-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|
@@ -138,6 +138,12 @@ files:
|
|
138
138
|
- tests/Rakefile.common
|
139
139
|
- tests/command/Rakefile
|
140
140
|
- tests/command/ReplaceNode.mfrp
|
141
|
+
- tests/compiler/AtlastDependency/AtlastDependency.mfrp
|
142
|
+
- tests/compiler/AtlastDependency/AtlastDependencyMain.c
|
143
|
+
- tests/compiler/AtlastDependency/Rakefile
|
144
|
+
- tests/compiler/AtlastDependency/actual_out.txt
|
145
|
+
- tests/compiler/AtlastDependency/expected_out.txt
|
146
|
+
- tests/compiler/AtlastDependency/in.txt
|
141
147
|
- tests/compiler/ComplexDataType/ComplexDataType.mfrp
|
142
148
|
- tests/compiler/ComplexDataType/ComplexDataTypeMain.c
|
143
149
|
- tests/compiler/ComplexDataType/Rakefile
|
@@ -159,8 +165,21 @@ files:
|
|
159
165
|
- tests/compiler/LCDPositioner/graph.dot
|
160
166
|
- tests/compiler/LCDPositioner/graph.png
|
161
167
|
- tests/compiler/LCDPositioner/in.txt
|
168
|
+
- tests/compiler/NestedMatch/NestedMatch.mfrp
|
169
|
+
- tests/compiler/NestedMatch/NestedMatchMain.c
|
170
|
+
- tests/compiler/NestedMatch/Rakefile
|
171
|
+
- tests/compiler/NestedMatch/actual_out.txt
|
172
|
+
- tests/compiler/NestedMatch/expected_out.txt
|
173
|
+
- tests/compiler/NestedMatch/in.txt
|
162
174
|
- tests/compiler/Rakefile
|
163
175
|
- tests/compiler/Rakefile.common
|
176
|
+
- tests/compiler/SubModuleInit/Delay2.mfrp
|
177
|
+
- tests/compiler/SubModuleInit/Rakefile
|
178
|
+
- tests/compiler/SubModuleInit/SubModuleInit.mfrp
|
179
|
+
- tests/compiler/SubModuleInit/SubModuleInitMain.c
|
180
|
+
- tests/compiler/SubModuleInit/actual_out.txt
|
181
|
+
- tests/compiler/SubModuleInit/expected_out.txt
|
182
|
+
- tests/compiler/SubModuleInit/in.txt
|
164
183
|
- tests/compiler/UseData/Rakefile
|
165
184
|
- tests/compiler/UseData/UseData.mfrp
|
166
185
|
- tests/compiler/UseData/UseDataMain.c
|
@@ -204,7 +223,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
204
223
|
version: '0'
|
205
224
|
requirements: []
|
206
225
|
rubyforge_project:
|
207
|
-
rubygems_version: 2.
|
226
|
+
rubygems_version: 2.5.2.2
|
208
227
|
signing_key:
|
209
228
|
specification_version: 4
|
210
229
|
summary: A compier of Emfrp, a FRP language for small embeded systems.
|