rlang 0.5.1 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/Gemfile.lock +3 -5
- data/README +11 -0
- data/bin/rlang +4 -0
- data/docs/RlangCompiler.md +2 -0
- data/docs/RlangManual.md +37 -8
- data/lib/rlang/lib/array/array32.rb +13 -4
- data/lib/rlang/lib/array/array64.rb +11 -3
- data/lib/rlang/lib/base64.rb +223 -0
- data/lib/rlang/lib/io.rb +7 -2
- data/lib/rlang/lib/malloc.rb +5 -3
- data/lib/rlang/lib/object.rb +23 -0
- data/lib/rlang/lib/rlang_core.rb +2 -1
- data/lib/rlang/lib/string.rb +95 -11
- data/lib/rlang/lib/type/i32.rb +30 -12
- data/lib/rlang/lib/type/i64.rb +0 -2
- data/lib/rlang/lib/wasi.rb +57 -6
- data/lib/rlang/parser/data.rb +5 -0
- data/lib/rlang/parser/ext/integer.rb +3 -1
- data/lib/rlang/parser/ext/type.rb +30 -1
- data/lib/rlang/parser/global.rb +7 -0
- data/lib/rlang/parser/wgenerator.rb +221 -83
- data/lib/rlang/parser/wnode.rb +41 -14
- data/lib/rlang/parser/wtype.rb +12 -6
- data/lib/rlang/parser.rb +182 -130
- data/lib/rlang/version.rb +1 -1
- data/lib/ruby/mirror/rstring.rb +16 -0
- data/lib/utils/exceptions.rb +12 -0
- data/rlang.gemspec +4 -4
- metadata +16 -12
data/lib/rlang/version.rb
CHANGED
@@ -0,0 +1,16 @@
|
|
1
|
+
# Rlang WebAssembly compiler
|
2
|
+
# Copyright (c) 2019-2022, Laurent Julliard and contributors
|
3
|
+
# All rights reserved.
|
4
|
+
|
5
|
+
require 'wasmer'
|
6
|
+
|
7
|
+
class RString < String
|
8
|
+
# Turn a Rlang String object into a Ruby String mirror object
|
9
|
+
def initialize(wasm_instance, rlang_obj_addr)
|
10
|
+
stg_ptr = wasm_instance.exports.string_i_ptr.call(rlang_obj_addr)
|
11
|
+
stg_length = wasm_instance.exports.string_i_length.call(rlang_obj_addr)
|
12
|
+
mem8 = wasm_instance.exports.memory.uint8_view stg_ptr
|
13
|
+
ruby_stg = 0.upto(stg_length-1).collect {|i| mem8[i].chr}.join('')
|
14
|
+
super(ruby_stg)
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# Rubinius WebAssembly VM
|
2
|
+
# Copyright (c) 2019, Laurent Julliard and contributors
|
3
|
+
# All rights reserved.
|
4
|
+
#
|
5
|
+
# Rlang exceptions
|
6
|
+
|
7
|
+
class RlangSyntaxError < StandardError; end
|
8
|
+
|
9
|
+
def rlse(node, msg)
|
10
|
+
msg += "\nline #{node.location.line}: #{node.location.expression.source}"
|
11
|
+
raise RlangSyntaxError, msg, []
|
12
|
+
end
|
data/rlang.gemspec
CHANGED
@@ -10,8 +10,8 @@ Gem::Specification.new do |spec|
|
|
10
10
|
|
11
11
|
spec.summary = %q{A (subset of) Ruby to WebAssembly compiler}
|
12
12
|
spec.description = %q{Rlang is meant to create fast and uncluttered WebAssembly code
|
13
|
-
from the comfort of
|
14
|
-
subset of the Ruby language and a compiler transforming this Ruby subset in a valid
|
13
|
+
from the comfort of a Ruby-like language. It is actually made of two things: the Rlang
|
14
|
+
language that supports a subset of the Ruby language and a compiler transforming this Ruby subset in a valid
|
15
15
|
and fully runnable WebAssembly module.}
|
16
16
|
spec.homepage = "https://github.com/ljulliar/rlang"
|
17
17
|
spec.license = "MPL-2.0"
|
@@ -31,11 +31,11 @@ Gem::Specification.new do |spec|
|
|
31
31
|
spec.executables << "rlang"
|
32
32
|
spec.require_paths = ["lib"]
|
33
33
|
|
34
|
-
spec.add_runtime_dependency 'parser'
|
34
|
+
spec.add_runtime_dependency 'parser', "~> 3.1"
|
35
35
|
|
36
36
|
spec.add_development_dependency "bundler", "~> 2.0"
|
37
37
|
spec.add_development_dependency "rake", "~> 12.0"
|
38
38
|
spec.add_development_dependency "minitest", "~> 5.0"
|
39
|
-
spec.add_development_dependency "wasmer", "~> 0
|
39
|
+
spec.add_development_dependency "wasmer", "~> 1.0"
|
40
40
|
spec.add_development_dependency "simplecov", "~> 0.18"
|
41
41
|
end
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rlang
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Laurent Julliard
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-06-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parser
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '3.1'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '3.1'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -72,14 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '0
|
75
|
+
version: '1.0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '0
|
82
|
+
version: '1.0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: simplecov
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -95,9 +95,9 @@ dependencies:
|
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0.18'
|
97
97
|
description: "Rlang is meant to create fast and uncluttered WebAssembly code \n from
|
98
|
-
the comfort of
|
99
|
-
\n subset of the Ruby language and a compiler transforming
|
100
|
-
a valid \n and fully runnable WebAssembly module."
|
98
|
+
the comfort of a Ruby-like language. It is actually made of two things: the Rlang
|
99
|
+
\n language that supports a subset of the Ruby language and a compiler transforming
|
100
|
+
this Ruby subset in a valid \n and fully runnable WebAssembly module."
|
101
101
|
email:
|
102
102
|
- laurent@moldus.org
|
103
103
|
executables:
|
@@ -112,6 +112,7 @@ files:
|
|
112
112
|
- Gemfile
|
113
113
|
- Gemfile.lock
|
114
114
|
- LICENSE
|
115
|
+
- README
|
115
116
|
- README.md
|
116
117
|
- Rakefile
|
117
118
|
- bin/rlang
|
@@ -133,6 +134,7 @@ files:
|
|
133
134
|
- lib/rlang/lib/array.rb
|
134
135
|
- lib/rlang/lib/array/array32.rb
|
135
136
|
- lib/rlang/lib/array/array64.rb
|
137
|
+
- lib/rlang/lib/base64.rb
|
136
138
|
- lib/rlang/lib/io.rb
|
137
139
|
- lib/rlang/lib/kernel.rb
|
138
140
|
- lib/rlang/lib/malloc.c
|
@@ -169,9 +171,11 @@ files:
|
|
169
171
|
- lib/rlang/parser/wtree.rb
|
170
172
|
- lib/rlang/parser/wtype.rb
|
171
173
|
- lib/rlang/version.rb
|
174
|
+
- lib/ruby/mirror/rstring.rb
|
172
175
|
- lib/simul/classes/data.rb
|
173
176
|
- lib/simul/classes/global.rb
|
174
177
|
- lib/simul/classes/memory.rb
|
178
|
+
- lib/utils/exceptions.rb
|
175
179
|
- lib/utils/log.rb
|
176
180
|
- rlang.gemspec
|
177
181
|
homepage: https://github.com/ljulliar/rlang
|
@@ -196,7 +200,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
196
200
|
- !ruby/object:Gem::Version
|
197
201
|
version: '0'
|
198
202
|
requirements: []
|
199
|
-
rubygems_version: 3.0.
|
203
|
+
rubygems_version: 3.0.9
|
200
204
|
signing_key:
|
201
205
|
specification_version: 4
|
202
206
|
summary: A (subset of) Ruby to WebAssembly compiler
|