emfrp 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +45 -12
- data/bin/emfrp +4 -1
- data/examples/LCDClock/LCDClock.mfrp +93 -93
- data/examples/LCDClock/LCDClock_LPC1768.bin +0 -0
- data/examples/LCDClock/README.md +24 -24
- data/examples/LCDPositioner/LCDPositioner.mfrp +30 -30
- data/examples/LCDPositioner/LCDPositionerMain.c +15 -15
- data/examples/MostDistantPoint/MostDistantPoint.mfrp +25 -25
- data/examples/MostDistantPoint/MostDistantPointMain.c +14 -14
- data/lib/emfrp/compile/c/alloc.rb +200 -200
- data/lib/emfrp/compile/c/codegen.rb +18 -18
- data/lib/emfrp/compile/c/codegen_context.rb +218 -218
- data/lib/emfrp/compile/c/monofy.rb +185 -185
- data/lib/emfrp/compile/c/syntax_codegen.rb +364 -364
- data/lib/emfrp/compile/c/syntax_exp_codegen.rb +119 -119
- data/lib/emfrp/compile/graphviz/graphviz.rb +53 -53
- data/lib/emfrp/compile_error.rb +95 -95
- data/lib/emfrp/interpreter/command_manager.rb +367 -367
- data/lib/emfrp/interpreter/evaluater.rb +146 -146
- data/lib/emfrp/interpreter/file_loader.rb +52 -52
- data/lib/emfrp/interpreter/interpreter.rb +200 -195
- data/lib/emfrp/parser/expression.rb +386 -386
- data/lib/emfrp/parser/misc.rb +184 -184
- data/lib/emfrp/parser/newnode_convert.rb +72 -72
- data/lib/emfrp/parser/operator.rb +25 -25
- data/lib/emfrp/parser/parser.rb +150 -150
- data/lib/emfrp/parser/parsing_error.rb +49 -49
- data/lib/emfrp/parser/toplevel.rb +555 -555
- data/lib/emfrp/pre_convert/pre_convert.rb +32 -32
- data/lib/emfrp/syntax.rb +171 -171
- data/lib/emfrp/typing/typing_error.rb +47 -47
- data/lib/emfrp/typing/union_type.rb +197 -197
- data/lib/emfrp/version.rb +1 -1
- data/mfrp_include/Std.mfrp +122 -122
- data/tests/Rakefile +8 -8
- data/tests/Rakefile.common +27 -27
- data/tests/command/Rakefile +2 -2
- data/tests/command/ReplaceNode.mfrp +39 -39
- data/tests/compiler/ComplexDataType/ComplexDataType.mfrp +14 -14
- data/tests/compiler/ComplexDataType/ComplexDataTypeMain.c +15 -15
- data/tests/compiler/ComplexDataType/Rakefile +2 -2
- data/tests/compiler/ComplexDataType/expected_out.txt +0 -0
- data/tests/compiler/ComplexDataType/in.txt +5 -5
- data/tests/compiler/LCDClock/LCDClock.mfrp +90 -90
- data/tests/compiler/LCDClock/LCDClockMain.c +0 -0
- data/tests/compiler/LCDClock/Rakefile +2 -2
- data/tests/compiler/LCDClock/expected_out.txt +0 -0
- data/tests/compiler/LCDClock/in.txt +0 -0
- data/tests/compiler/LCDPositioner/LCDPositioner.mfrp +30 -30
- data/tests/compiler/LCDPositioner/LCDPositionerMain.c +15 -15
- data/tests/compiler/LCDPositioner/Rakefile +2 -2
- data/tests/compiler/LCDPositioner/graph.dot +0 -0
- data/tests/compiler/LCDPositioner/graph.png +0 -0
- data/tests/compiler/Rakefile +8 -8
- data/tests/compiler/Rakefile.common +23 -23
- data/tests/compiler/UseData/Rakefile +2 -2
- data/tests/compiler/UseData/UseData.mfrp +8 -8
- data/tests/compiler/UseSubModule/Rakefile +2 -2
- data/tests/compiler/UseSubModule/SubModule.mfrp +8 -8
- data/tests/compiler/UseSubModule/SubModule2.mfrp +5 -5
- data/tests/compiler/UseSubModule/UseSubModule.mfrp +11 -11
- data/tests/core/FromAnnotation.mfrp +18 -18
- data/tests/core/Last.mfrp +10 -10
- data/tests/core/Rakefile +2 -2
- data/tests/core/TypingTest.mfrp +11 -11
- data/tests/core/WithoutInputs.mfrp +19 -19
- data/tests/load_time_error/Rakefile +32 -32
- data/tests/load_time_error/TypeMismatch.mfrp +4 -4
- metadata +3 -3
@@ -1,18 +1,18 @@
|
|
1
|
-
module FromAnnotation
|
2
|
-
in
|
3
|
-
i : Int
|
4
|
-
out
|
5
|
-
n1 : Int,
|
6
|
-
n2 : Int
|
7
|
-
use Std
|
8
|
-
|
9
|
-
node init[0] from[i, n1@last]
|
10
|
-
n1 = n1@last + i
|
11
|
-
|
12
|
-
node init[0]
|
13
|
-
n2 = n2@last + i
|
14
|
-
|
15
|
-
#@ :assert-module 0 => 0, 0
|
16
|
-
#@ : 1 => 1, 1
|
17
|
-
#@ : 1 => 2, 2
|
18
|
-
#@ : 2 => 4, 4
|
1
|
+
module FromAnnotation
|
2
|
+
in
|
3
|
+
i : Int
|
4
|
+
out
|
5
|
+
n1 : Int,
|
6
|
+
n2 : Int
|
7
|
+
use Std
|
8
|
+
|
9
|
+
node init[0] from[i, n1@last]
|
10
|
+
n1 = n1@last + i
|
11
|
+
|
12
|
+
node init[0]
|
13
|
+
n2 = n2@last + i
|
14
|
+
|
15
|
+
#@ :assert-module 0 => 0, 0
|
16
|
+
#@ : 1 => 1, 1
|
17
|
+
#@ : 1 => 2, 2
|
18
|
+
#@ : 2 => 4, 4
|
data/tests/core/Last.mfrp
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
module Last in x:Int out y use Std
|
2
|
-
|
3
|
-
node init[0] a = x
|
4
|
-
node y = a@last
|
5
|
-
|
6
|
-
#@ :assert-module
|
7
|
-
#- 1 => 0
|
8
|
-
#@ : 2 => 1
|
9
|
-
#@ : 3 => 2
|
10
|
-
#@ : 4 => 3
|
1
|
+
module Last in x:Int out y use Std
|
2
|
+
|
3
|
+
node init[0] a = x
|
4
|
+
node y = a@last
|
5
|
+
|
6
|
+
#@ :assert-module
|
7
|
+
#- 1 => 0
|
8
|
+
#@ : 2 => 1
|
9
|
+
#@ : 3 => 2
|
10
|
+
#@ : 4 => 3
|
data/tests/core/Rakefile
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
load File.expand_path('../../Rakefile.common', __FILE__)
|
2
|
-
task :default => ["Std"] + TARGETS
|
1
|
+
load File.expand_path('../../Rakefile.common', __FILE__)
|
2
|
+
task :default => ["Std"] + TARGETS
|
data/tests/core/TypingTest.mfrp
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
material TypingTest use Std
|
2
|
-
|
3
|
-
#@ :assert-type x => Tuple2[Int, Unit]
|
4
|
-
data x = ((1, 2), Unit) of ((a, b), c) -> (a, c)
|
5
|
-
|
6
|
-
#@ :assert-type y => Maybe[Int]
|
7
|
-
data y : Maybe[Int] = Nothing
|
8
|
-
|
9
|
-
#@ :assert-type z => Tuple2[Int, Double]
|
10
|
-
func id(x) = x
|
11
|
-
data z = (id(1), id(1.0))
|
1
|
+
material TypingTest use Std
|
2
|
+
|
3
|
+
#@ :assert-type x => Tuple2[Int, Unit]
|
4
|
+
data x = ((1, 2), Unit) of ((a, b), c) -> (a, c)
|
5
|
+
|
6
|
+
#@ :assert-type y => Maybe[Int]
|
7
|
+
data y : Maybe[Int] = Nothing
|
8
|
+
|
9
|
+
#@ :assert-type z => Tuple2[Int, Double]
|
10
|
+
func id(x) = x
|
11
|
+
data z = (id(1), id(1.0))
|
@@ -1,19 +1,19 @@
|
|
1
|
-
# testing no-inputs module
|
2
|
-
module WithoutInputs
|
3
|
-
out
|
4
|
-
x : Int
|
5
|
-
use Std
|
6
|
-
|
7
|
-
#@ :assert-node x 0 => 1
|
8
|
-
#@ :assert-node x 1 => 2
|
9
|
-
node init[0] x = x@last + 1
|
10
|
-
|
11
|
-
# testing no-dependings node
|
12
|
-
#@ :assert-node const0 => 0
|
13
|
-
node const0 = 0
|
14
|
-
|
15
|
-
#@ :assert-module
|
16
|
-
#- => 1
|
17
|
-
#@ : => 2
|
18
|
-
#@ : => 3
|
19
|
-
#@ : => 4
|
1
|
+
# testing no-inputs module
|
2
|
+
module WithoutInputs
|
3
|
+
out
|
4
|
+
x : Int
|
5
|
+
use Std
|
6
|
+
|
7
|
+
#@ :assert-node x 0 => 1
|
8
|
+
#@ :assert-node x 1 => 2
|
9
|
+
node init[0] x = x@last + 1
|
10
|
+
|
11
|
+
# testing no-dependings node
|
12
|
+
#@ :assert-node const0 => 0
|
13
|
+
node const0 = 0
|
14
|
+
|
15
|
+
#@ :assert-module
|
16
|
+
#- => 1
|
17
|
+
#@ : => 2
|
18
|
+
#@ : => 3
|
19
|
+
#@ : => 4
|
@@ -1,32 +1,32 @@
|
|
1
|
-
$LOAD_PATH.unshift File.expand_path('../../../lib', __FILE__)
|
2
|
-
require 'emfrp'
|
3
|
-
require 'stringio'
|
4
|
-
|
5
|
-
TARGETS = Dir.glob("./*.mfrp").map{|x| x =~ /^\.\/(.*).mfrp$/; $1}
|
6
|
-
|
7
|
-
task :default => TARGETS
|
8
|
-
|
9
|
-
TARGETS.each do |t|
|
10
|
-
file t do
|
11
|
-
puts "TESTING #{t}".colorize(:light_blue)
|
12
|
-
expected_code = File.open("#{t}.mfrp", 'r'){|f| f.gets[1..-1].chomp.strip.to_sym}
|
13
|
-
begin
|
14
|
-
out = StringIO.new
|
15
|
-
inter = Emfrp::Interpreter.new(Emfrp::IncludeDirs, out, t)
|
16
|
-
puts " => fail".colorize(:red)
|
17
|
-
rescue Emfrp::Interpreter::InterpreterError => err
|
18
|
-
if err.code == expected_code
|
19
|
-
puts " => ok".colorize(:green)
|
20
|
-
else
|
21
|
-
puts "Error code `#{expected_code}' is expected, but actual is `#{err.code}'."
|
22
|
-
out.string.each_line do |line|
|
23
|
-
print ">> " + line
|
24
|
-
end
|
25
|
-
puts " => fail".colorize(:red)
|
26
|
-
end
|
27
|
-
rescue => err
|
28
|
-
puts err.inspect
|
29
|
-
puts " => fail".colorize(:red)
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
1
|
+
$LOAD_PATH.unshift File.expand_path('../../../lib', __FILE__)
|
2
|
+
require 'emfrp'
|
3
|
+
require 'stringio'
|
4
|
+
|
5
|
+
TARGETS = Dir.glob("./*.mfrp").map{|x| x =~ /^\.\/(.*).mfrp$/; $1}
|
6
|
+
|
7
|
+
task :default => TARGETS
|
8
|
+
|
9
|
+
TARGETS.each do |t|
|
10
|
+
file t do
|
11
|
+
puts "TESTING #{t}".colorize(:light_blue)
|
12
|
+
expected_code = File.open("#{t}.mfrp", 'r'){|f| f.gets[1..-1].chomp.strip.to_sym}
|
13
|
+
begin
|
14
|
+
out = StringIO.new
|
15
|
+
inter = Emfrp::Interpreter.new(Emfrp::IncludeDirs, out, t)
|
16
|
+
puts " => fail".colorize(:red)
|
17
|
+
rescue Emfrp::Interpreter::InterpreterError => err
|
18
|
+
if err.code == expected_code
|
19
|
+
puts " => ok".colorize(:green)
|
20
|
+
else
|
21
|
+
puts "Error code `#{expected_code}' is expected, but actual is `#{err.code}'."
|
22
|
+
out.string.each_line do |line|
|
23
|
+
print ">> " + line
|
24
|
+
end
|
25
|
+
puts " => fail".colorize(:red)
|
26
|
+
end
|
27
|
+
rescue => err
|
28
|
+
puts err.inspect
|
29
|
+
puts " => fail".colorize(:red)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# unify
|
2
|
-
material TypeMismatch use Std
|
3
|
-
|
4
|
-
data x = 1 + 1.1
|
1
|
+
# unify
|
2
|
+
material TypeMismatch use Std
|
3
|
+
|
4
|
+
data x = 1 + 1.1
|
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.3
|
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: 2018-11-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|
@@ -204,7 +204,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
204
204
|
version: '0'
|
205
205
|
requirements: []
|
206
206
|
rubyforge_project:
|
207
|
-
rubygems_version: 2.
|
207
|
+
rubygems_version: 2.6.11
|
208
208
|
signing_key:
|
209
209
|
specification_version: 4
|
210
210
|
summary: A compier of Emfrp, a FRP language for small embeded systems.
|