emfrp 0.1.4 → 0.1.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: b22236346a774cffb9cf18b119085b0177a0aab6
4
- data.tar.gz: f0aeb3ec0dd857f2ba08678f0a34b8398bd529a9
2
+ SHA256:
3
+ metadata.gz: 990c1ccf97f667ebb79f79f1f0e480ebcb40fe7ca379e4ea0ddecf4907f4c709
4
+ data.tar.gz: 45914615a642a6aa2fe41dff756c8150acf6622d758cfb482c29ec6eeed8fe73
5
5
  SHA512:
6
- metadata.gz: bbbbb76bac2428193c34ce526269dfa8d524116de18f419a6d1536809eb655449e3f7c186511ea99bad08fca175a7c501092bb05381a6e4c7b3a5812b3534610
7
- data.tar.gz: 29135f70e0b9607465857decad838a735ef00dd93db938a1b5b98dc17b53af31eeaaff244be759578ad06dc9704373bcf435c374c5abea53f00dec8e9bcefeec
6
+ metadata.gz: bc9f730f0f723f718eb5bc6909a48a7417c1a39641faa5e6738e9192f9fc45387eddb7f002c8eabf9128a3d1c1848915b5582e578086ad19d6d207b8634343aa
7
+ data.tar.gz: 7f5a4ad5655cbb96faed550dff8add18e1aa5a09d7157721da8dd192e0dca09ab64275898a722451d7bdd495a26a25418406cb53b8505e0fac3d16968aac0b95
@@ -0,0 +1,20 @@
1
+ name: Test
2
+
3
+ on: [push, pull_request]
4
+
5
+ jobs:
6
+ build:
7
+
8
+ runs-on: ubuntu-latest
9
+
10
+ steps:
11
+ - uses: actions/checkout@v1
12
+ - name: Set up Ruby 2.6
13
+ uses: actions/setup-ruby@v1
14
+ with:
15
+ ruby-version: 2.6.x
16
+ - name: Build and test with Rake
17
+ run: |
18
+ bundle install --jobs 4 --retry 3
19
+ cd tests && bundle exec rake
20
+
data/Gemfile CHANGED
@@ -2,5 +2,3 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in emfrp.gemspec
4
4
  gemspec
5
- colorize
6
- parser_combinator
@@ -43,7 +43,7 @@ module Emfrp
43
43
  i >= ref_pos_last(x)
44
44
  end
45
45
  crefs.reject! do |x|
46
- i >= ref_pos_current(x)
46
+ ref_pos_last(x) == -1 and i >= ref_pos_current(x)
47
47
  end
48
48
  end
49
49
  return max_amount
@@ -146,6 +146,7 @@ module Emfrp
146
146
  while_stmts << "if (#{mn} < Counter) { x = #{memory_name(ct)} + #{memory_counter_name(ct)}; break; }"
147
147
  s << "#{ref_name(ct)} x;"
148
148
  s << ct.make_block("while (1) {", while_stmts, "}")
149
+ s << "x->mark = 0;"
149
150
  s << "x->tvalue_id = #{i};" if self[:tvalues].length > 1
150
151
  tvalue[:params].each_with_index do |param, i|
151
152
  s << "x->value.#{tvalue.struct_name(ct)}.member#{i} = member#{i};"
@@ -159,7 +160,7 @@ module Emfrp
159
160
  return if enum?(ct)
160
161
  params = [[ref_name(ct), "x"], ["int", "mark"]]
161
162
  ct.define_func("void", marker_func_name(ct), params) do |x|
162
- x << "x->mark = mark;" unless self[:static]
163
+ x << "if (mark > x->mark) { x->mark = mark; }" unless self[:static]
163
164
  accessor = self[:static] ? "." : "->"
164
165
  cases = []
165
166
  self[:tvalues].each_with_index do |tvalue, i|
@@ -72,6 +72,8 @@ module Emfrp
72
72
  end
73
73
  if i == 0
74
74
  stmts << ct.make_block("if (#{cond_exp}) {", then_stmts, "}")
75
+ elsif i == self[:cases].length - 1
76
+ stmts << ct.make_block("else {", then_stmts, "}")
75
77
  else
76
78
  stmts << ct.make_block("else if (#{cond_exp}) {", then_stmts, "}")
77
79
  end
@@ -1,3 +1,3 @@
1
1
  module Emfrp
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
@@ -0,0 +1,13 @@
1
+ module GCLifeTime
2
+ in a : Int
3
+ out x
4
+ use Std
5
+
6
+ type Wrap = Wrap(Int)
7
+
8
+ node init[Wrap(0)] wrap = Wrap(a)
9
+ node ref = wrap
10
+ node unwrap = ref of Wrap(val) -> val
11
+ node rewrap = Wrap(unwrap)
12
+
13
+ node x = (wrap@last, rewrap) of (Wrap(p), Wrap(q)) -> p + q
@@ -0,0 +1,17 @@
1
+ #include "GCLifeTime.h"
2
+ #include <stdio.h>
3
+ #include <stdlib.h>
4
+
5
+ void Input(int* a) {
6
+ if (scanf("%d", a) == EOF) {
7
+ exit(0);
8
+ }
9
+ }
10
+
11
+ void Output(int* x) {
12
+ printf("%d\n", *x);
13
+ }
14
+
15
+ int main() {
16
+ ActivateGCLifeTime();
17
+ }
@@ -0,0 +1,2 @@
1
+ NAME = "GCLifeTime"
2
+ load File.expand_path('../../Rakefile.common', __FILE__)
@@ -0,0 +1,10 @@
1
+ 1
2
+ 3
3
+ 5
4
+ 7
5
+ 9
6
+ 11
7
+ 13
8
+ 15
9
+ 17
10
+ 19
@@ -0,0 +1,10 @@
1
+ 1
2
+ 3
3
+ 5
4
+ 7
5
+ 9
6
+ 11
7
+ 13
8
+ 15
9
+ 17
10
+ 19
@@ -0,0 +1,10 @@
1
+ 1
2
+ 2
3
+ 3
4
+ 4
5
+ 5
6
+ 6
7
+ 7
8
+ 8
9
+ 9
10
+ 10
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
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kensuke Sawada
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-06-29 00:00:00.000000000 Z
11
+ date: 2019-11-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorize
@@ -75,6 +75,7 @@ executables:
75
75
  extensions: []
76
76
  extra_rdoc_files: []
77
77
  files:
78
+ - ".github/workflows/test.yml"
78
79
  - ".gitignore"
79
80
  - Gemfile
80
81
  - LICENSE
@@ -151,6 +152,12 @@ files:
151
152
  - tests/compiler/ComplexDataType/expected_out.txt
152
153
  - tests/compiler/ComplexDataType/graph.png
153
154
  - tests/compiler/ComplexDataType/in.txt
155
+ - tests/compiler/GCLifeTime/GCLifeTime.mfrp
156
+ - tests/compiler/GCLifeTime/GCLifeTimeMain.c
157
+ - tests/compiler/GCLifeTime/Rakefile
158
+ - tests/compiler/GCLifeTime/actual_out.txt
159
+ - tests/compiler/GCLifeTime/expected_out.txt
160
+ - tests/compiler/GCLifeTime/in.txt
154
161
  - tests/compiler/LCDClock/LCDClock.mfrp
155
162
  - tests/compiler/LCDClock/LCDClockMain.c
156
163
  - tests/compiler/LCDClock/Rakefile
@@ -222,8 +229,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
222
229
  - !ruby/object:Gem::Version
223
230
  version: '0'
224
231
  requirements: []
225
- rubyforge_project:
226
- rubygems_version: 2.5.2.2
232
+ rubygems_version: 3.0.3
227
233
  signing_key:
228
234
  specification_version: 4
229
235
  summary: A compier of Emfrp, a FRP language for small embeded systems.