emfrp 0.0.1
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 +7 -0
- data/.gitignore +14 -0
- data/Gemfile +6 -0
- data/LICENSE +28 -0
- data/README.md +27 -0
- data/Rakefile +2 -0
- data/bin/emfrp +21 -0
- data/bin/emfrpi +24 -0
- data/emfrp.gemspec +26 -0
- data/examples/LCDPositioner/LCDPositioner.c +278 -0
- data/examples/LCDPositioner/LCDPositioner.h +6 -0
- data/examples/LCDPositioner/LCDPositioner.mfrp +30 -0
- data/examples/LCDPositioner/LCDPositionerMain.c +15 -0
- data/examples/LCDPositioner/LCDPositionerMain.c.gen +11 -0
- data/examples/LCDPositioner/graph.dot +31 -0
- data/examples/LCDPositioner/graph.png +0 -0
- data/examples/MostDistantPoint/MostDistantPoint.c +199 -0
- data/examples/MostDistantPoint/MostDistantPoint.h +6 -0
- data/examples/MostDistantPoint/MostDistantPoint.mfrp +25 -0
- data/examples/MostDistantPoint/MostDistantPointMain.c +14 -0
- data/examples/MostDistantPoint/graph.dot +12 -0
- data/examples/MostDistantPoint/graph.png +0 -0
- data/lib/emfrp/compile/c/alloc.rb +200 -0
- data/lib/emfrp/compile/c/codegen.rb +18 -0
- data/lib/emfrp/compile/c/codegen_context.rb +215 -0
- data/lib/emfrp/compile/c/monofy.rb +185 -0
- data/lib/emfrp/compile/c/syntax_codegen.rb +364 -0
- data/lib/emfrp/compile/c/syntax_exp_codegen.rb +119 -0
- data/lib/emfrp/compile/graphviz/graphviz.rb +49 -0
- data/lib/emfrp/compile_error.rb +95 -0
- data/lib/emfrp/interpreter/command_manager.rb +367 -0
- data/lib/emfrp/interpreter/evaluater.rb +146 -0
- data/lib/emfrp/interpreter/file_loader.rb +52 -0
- data/lib/emfrp/interpreter/interpreter.rb +195 -0
- data/lib/emfrp/parser/expression.rb +386 -0
- data/lib/emfrp/parser/misc.rb +184 -0
- data/lib/emfrp/parser/operator.rb +25 -0
- data/lib/emfrp/parser/parser.rb +145 -0
- data/lib/emfrp/parser/parsing_error.rb +49 -0
- data/lib/emfrp/parser/toplevel.rb +523 -0
- data/lib/emfrp/pre_convert/alpha_convert.rb +119 -0
- data/lib/emfrp/pre_convert/make_name_dict.rb +96 -0
- data/lib/emfrp/pre_convert/node_check.rb +60 -0
- data/lib/emfrp/pre_convert/pre_convert.rb +32 -0
- data/lib/emfrp/syntax.rb +169 -0
- data/lib/emfrp/typing/typing.rb +256 -0
- data/lib/emfrp/typing/typing_error.rb +47 -0
- data/lib/emfrp/typing/union_type.rb +197 -0
- data/lib/emfrp/version.rb +3 -0
- data/lib/emfrp.rb +14 -0
- data/mfrp_include/Std.mfrp +122 -0
- data/tests/Rakefile +8 -0
- data/tests/Rakefile.common +27 -0
- data/tests/command/Rakefile +2 -0
- data/tests/command/ReplaceNode.mfrp +39 -0
- data/tests/compiler/ComplexDataType/ComplexDataType.mfrp +14 -0
- data/tests/compiler/ComplexDataType/ComplexDataTypeMain.c +15 -0
- data/tests/compiler/ComplexDataType/Rakefile +2 -0
- data/tests/compiler/ComplexDataType/actual_out.txt +5 -0
- data/tests/compiler/ComplexDataType/expected_out.txt +5 -0
- data/tests/compiler/ComplexDataType/graph.png +0 -0
- data/tests/compiler/ComplexDataType/in.txt +5 -0
- data/tests/compiler/LCDPositioner/LCDPositioner.mfrp +30 -0
- data/tests/compiler/LCDPositioner/LCDPositionerMain.c +15 -0
- data/tests/compiler/LCDPositioner/Rakefile +2 -0
- data/tests/compiler/LCDPositioner/actual_out.txt +9 -0
- data/tests/compiler/LCDPositioner/expected_out.txt +9 -0
- data/tests/compiler/LCDPositioner/graph.dot +31 -0
- data/tests/compiler/LCDPositioner/graph.png +0 -0
- data/tests/compiler/LCDPositioner/in.txt +11 -0
- data/tests/compiler/Rakefile +8 -0
- data/tests/compiler/Rakefile.common +23 -0
- data/tests/core/FromAnnotation.mfrp +18 -0
- data/tests/core/Last.mfrp +10 -0
- data/tests/core/Rakefile +2 -0
- data/tests/core/TypingTest.mfrp +11 -0
- data/tests/core/WithoutInputs.mfrp +19 -0
- data/tests/load_time_error/Rakefile +32 -0
- data/tests/load_time_error/TypeMismatch.mfrp +4 -0
- metadata +180 -0
|
@@ -0,0 +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
|
|
@@ -0,0 +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
|
metadata
ADDED
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: emfrp
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.1
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Kensuke Sawada
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2015-12-17 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: colorize
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - ">="
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: 0.7.7
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - ">="
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: 0.7.7
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: parser_combinator
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - ">="
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: 0.0.3
|
|
34
|
+
type: :runtime
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - ">="
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: 0.0.3
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: bundler
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - "~>"
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '1.7'
|
|
48
|
+
type: :development
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - "~>"
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '1.7'
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: rake
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - "~>"
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '10.0'
|
|
62
|
+
type: :development
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - "~>"
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '10.0'
|
|
69
|
+
description: Pure Functional Programming with your microcomputer.
|
|
70
|
+
email:
|
|
71
|
+
- sasasawada@gmail.com
|
|
72
|
+
executables:
|
|
73
|
+
- emfrp
|
|
74
|
+
- emfrpi
|
|
75
|
+
extensions: []
|
|
76
|
+
extra_rdoc_files: []
|
|
77
|
+
files:
|
|
78
|
+
- ".gitignore"
|
|
79
|
+
- Gemfile
|
|
80
|
+
- LICENSE
|
|
81
|
+
- README.md
|
|
82
|
+
- Rakefile
|
|
83
|
+
- bin/emfrp
|
|
84
|
+
- bin/emfrpi
|
|
85
|
+
- emfrp.gemspec
|
|
86
|
+
- examples/LCDPositioner/LCDPositioner.c
|
|
87
|
+
- examples/LCDPositioner/LCDPositioner.h
|
|
88
|
+
- examples/LCDPositioner/LCDPositioner.mfrp
|
|
89
|
+
- examples/LCDPositioner/LCDPositionerMain.c
|
|
90
|
+
- examples/LCDPositioner/LCDPositionerMain.c.gen
|
|
91
|
+
- examples/LCDPositioner/graph.dot
|
|
92
|
+
- examples/LCDPositioner/graph.png
|
|
93
|
+
- examples/MostDistantPoint/MostDistantPoint.c
|
|
94
|
+
- examples/MostDistantPoint/MostDistantPoint.h
|
|
95
|
+
- examples/MostDistantPoint/MostDistantPoint.mfrp
|
|
96
|
+
- examples/MostDistantPoint/MostDistantPointMain.c
|
|
97
|
+
- examples/MostDistantPoint/graph.dot
|
|
98
|
+
- examples/MostDistantPoint/graph.png
|
|
99
|
+
- lib/emfrp.rb
|
|
100
|
+
- lib/emfrp/compile/c/alloc.rb
|
|
101
|
+
- lib/emfrp/compile/c/codegen.rb
|
|
102
|
+
- lib/emfrp/compile/c/codegen_context.rb
|
|
103
|
+
- lib/emfrp/compile/c/monofy.rb
|
|
104
|
+
- lib/emfrp/compile/c/syntax_codegen.rb
|
|
105
|
+
- lib/emfrp/compile/c/syntax_exp_codegen.rb
|
|
106
|
+
- lib/emfrp/compile/graphviz/graphviz.rb
|
|
107
|
+
- lib/emfrp/compile_error.rb
|
|
108
|
+
- lib/emfrp/interpreter/command_manager.rb
|
|
109
|
+
- lib/emfrp/interpreter/evaluater.rb
|
|
110
|
+
- lib/emfrp/interpreter/file_loader.rb
|
|
111
|
+
- lib/emfrp/interpreter/interpreter.rb
|
|
112
|
+
- lib/emfrp/parser/expression.rb
|
|
113
|
+
- lib/emfrp/parser/misc.rb
|
|
114
|
+
- lib/emfrp/parser/operator.rb
|
|
115
|
+
- lib/emfrp/parser/parser.rb
|
|
116
|
+
- lib/emfrp/parser/parsing_error.rb
|
|
117
|
+
- lib/emfrp/parser/toplevel.rb
|
|
118
|
+
- lib/emfrp/pre_convert/alpha_convert.rb
|
|
119
|
+
- lib/emfrp/pre_convert/make_name_dict.rb
|
|
120
|
+
- lib/emfrp/pre_convert/node_check.rb
|
|
121
|
+
- lib/emfrp/pre_convert/pre_convert.rb
|
|
122
|
+
- lib/emfrp/syntax.rb
|
|
123
|
+
- lib/emfrp/typing/typing.rb
|
|
124
|
+
- lib/emfrp/typing/typing_error.rb
|
|
125
|
+
- lib/emfrp/typing/union_type.rb
|
|
126
|
+
- lib/emfrp/version.rb
|
|
127
|
+
- mfrp_include/Std.mfrp
|
|
128
|
+
- tests/Rakefile
|
|
129
|
+
- tests/Rakefile.common
|
|
130
|
+
- tests/command/Rakefile
|
|
131
|
+
- tests/command/ReplaceNode.mfrp
|
|
132
|
+
- tests/compiler/ComplexDataType/ComplexDataType.mfrp
|
|
133
|
+
- tests/compiler/ComplexDataType/ComplexDataTypeMain.c
|
|
134
|
+
- tests/compiler/ComplexDataType/Rakefile
|
|
135
|
+
- tests/compiler/ComplexDataType/actual_out.txt
|
|
136
|
+
- tests/compiler/ComplexDataType/expected_out.txt
|
|
137
|
+
- tests/compiler/ComplexDataType/graph.png
|
|
138
|
+
- tests/compiler/ComplexDataType/in.txt
|
|
139
|
+
- tests/compiler/LCDPositioner/LCDPositioner.mfrp
|
|
140
|
+
- tests/compiler/LCDPositioner/LCDPositionerMain.c
|
|
141
|
+
- tests/compiler/LCDPositioner/Rakefile
|
|
142
|
+
- tests/compiler/LCDPositioner/actual_out.txt
|
|
143
|
+
- tests/compiler/LCDPositioner/expected_out.txt
|
|
144
|
+
- tests/compiler/LCDPositioner/graph.dot
|
|
145
|
+
- tests/compiler/LCDPositioner/graph.png
|
|
146
|
+
- tests/compiler/LCDPositioner/in.txt
|
|
147
|
+
- tests/compiler/Rakefile
|
|
148
|
+
- tests/compiler/Rakefile.common
|
|
149
|
+
- tests/core/FromAnnotation.mfrp
|
|
150
|
+
- tests/core/Last.mfrp
|
|
151
|
+
- tests/core/Rakefile
|
|
152
|
+
- tests/core/TypingTest.mfrp
|
|
153
|
+
- tests/core/WithoutInputs.mfrp
|
|
154
|
+
- tests/load_time_error/Rakefile
|
|
155
|
+
- tests/load_time_error/TypeMismatch.mfrp
|
|
156
|
+
homepage: ''
|
|
157
|
+
licenses:
|
|
158
|
+
- The BSD 3-Clause License
|
|
159
|
+
metadata: {}
|
|
160
|
+
post_install_message:
|
|
161
|
+
rdoc_options: []
|
|
162
|
+
require_paths:
|
|
163
|
+
- lib
|
|
164
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
165
|
+
requirements:
|
|
166
|
+
- - ">="
|
|
167
|
+
- !ruby/object:Gem::Version
|
|
168
|
+
version: '0'
|
|
169
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
170
|
+
requirements:
|
|
171
|
+
- - ">="
|
|
172
|
+
- !ruby/object:Gem::Version
|
|
173
|
+
version: '0'
|
|
174
|
+
requirements: []
|
|
175
|
+
rubyforge_project:
|
|
176
|
+
rubygems_version: 2.2.2
|
|
177
|
+
signing_key:
|
|
178
|
+
specification_version: 4
|
|
179
|
+
summary: A compier of Emfrp, a FRP language for small embeded systems.
|
|
180
|
+
test_files: []
|