forthic 0.1.0 → 0.2.4
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/CHANGELOG.md +6 -0
- data/CLAUDE.md +74 -0
- data/Guardfile +3 -3
- data/README.md +10 -0
- data/Rakefile +1 -1
- data/lib/forthic/code_location.rb +15 -0
- data/lib/forthic/errors/unknown_word_error.rb +39 -0
- data/lib/forthic/forthic_error.rb +16 -2
- data/lib/forthic/forthic_module.rb +10 -9
- data/lib/forthic/global_module.rb +321 -334
- data/lib/forthic/interpreter.rb +294 -104
- data/lib/forthic/token.rb +1 -2
- data/lib/forthic/tokenizer.rb +3 -3
- data/lib/forthic/variable.rb +1 -1
- data/lib/forthic/version.rb +1 -1
- data/lib/forthic/words/definition_word.rb +15 -17
- data/lib/forthic/words/end_array_word.rb +3 -3
- data/lib/forthic/words/end_module_word.rb +2 -2
- data/lib/forthic/words/imported_word.rb +3 -3
- data/lib/forthic/words/map_word.rb +5 -5
- data/lib/forthic/words/module_memo_bang_at_word.rb +3 -3
- data/lib/forthic/words/module_memo_bang_word.rb +3 -3
- data/lib/forthic/words/module_memo_word.rb +2 -2
- data/lib/forthic/words/module_word.rb +3 -3
- data/lib/forthic/words/push_value_word.rb +3 -3
- data/lib/forthic/words/start_module_word.rb +6 -6
- data/lib/forthic/words/word.rb +1 -1
- data/lib/forthic.rb +23 -19
- metadata +20 -10
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# # frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require_relative
|
|
4
|
-
require_relative
|
|
3
|
+
require_relative "word"
|
|
4
|
+
require_relative "../token"
|
|
5
5
|
|
|
6
6
|
module Forthic
|
|
7
7
|
class EndArrayWord < Word
|
|
@@ -25,4 +25,4 @@ module Forthic
|
|
|
25
25
|
interp.stack_push(items)
|
|
26
26
|
end
|
|
27
27
|
end
|
|
28
|
-
end
|
|
28
|
+
end
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# # frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require_relative
|
|
4
|
-
require_relative
|
|
3
|
+
require_relative "word"
|
|
4
|
+
require_relative "module_word"
|
|
5
5
|
|
|
6
6
|
module Forthic
|
|
7
7
|
class ImportedWord < Word
|
|
@@ -24,4 +24,4 @@ module Forthic
|
|
|
24
24
|
interp.module_stack_pop
|
|
25
25
|
end
|
|
26
26
|
end
|
|
27
|
-
end
|
|
27
|
+
end
|
|
@@ -157,13 +157,13 @@ module Forthic
|
|
|
157
157
|
|
|
158
158
|
errors = []
|
|
159
159
|
result = if items.is_a?(Array)
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
160
|
+
descend_list.call(items, @depth, [], errors)
|
|
161
|
+
else
|
|
162
|
+
descend_record.call(items, @depth, {}, errors)
|
|
163
|
+
end
|
|
164
164
|
@result = result
|
|
165
165
|
@errors = errors
|
|
166
166
|
[result, errors]
|
|
167
167
|
end
|
|
168
168
|
end
|
|
169
|
-
end
|
|
169
|
+
end
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# # frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require_relative
|
|
4
|
-
require_relative
|
|
3
|
+
require_relative "word"
|
|
4
|
+
require_relative "module_memo_word"
|
|
5
5
|
|
|
6
6
|
module Forthic
|
|
7
7
|
class ModuleMemoBangAtWord < Word
|
|
@@ -19,4 +19,4 @@ module Forthic
|
|
|
19
19
|
interp.stack_push(@memo_word.value)
|
|
20
20
|
end
|
|
21
21
|
end
|
|
22
|
-
end
|
|
22
|
+
end
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require_relative
|
|
4
|
-
require_relative
|
|
3
|
+
require_relative "word"
|
|
4
|
+
require_relative "module_memo_word"
|
|
5
5
|
|
|
6
6
|
module Forthic
|
|
7
7
|
class ModuleMemoBangWord < Word
|
|
@@ -18,4 +18,4 @@ module Forthic
|
|
|
18
18
|
@memo_word.refresh(interp)
|
|
19
19
|
end
|
|
20
20
|
end
|
|
21
|
-
end
|
|
21
|
+
end
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require_relative
|
|
3
|
+
require_relative "word"
|
|
4
4
|
|
|
5
5
|
module Forthic
|
|
6
6
|
class PushValueWord < Word
|
|
@@ -18,4 +18,4 @@ module Forthic
|
|
|
18
18
|
interp.stack_push(@value)
|
|
19
19
|
end
|
|
20
20
|
end
|
|
21
|
-
end
|
|
21
|
+
end
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
# # frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require_relative
|
|
4
|
-
require_relative
|
|
3
|
+
require_relative "word"
|
|
4
|
+
require_relative "../forthic_module"
|
|
5
5
|
|
|
6
6
|
module Forthic
|
|
7
7
|
class StartModuleWord < Word
|
|
8
8
|
# @param [Interpreter] interp
|
|
9
9
|
def execute(interp)
|
|
10
10
|
# The app module is the only module with a blank name
|
|
11
|
-
if
|
|
11
|
+
if name == ""
|
|
12
12
|
interp.module_stack_push(interp.get_app_module)
|
|
13
13
|
return
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
# If the module is used by the current module, push it onto the stack, otherwise
|
|
17
17
|
# create a new module.
|
|
18
|
-
mod = interp.cur_module.find_module(
|
|
18
|
+
mod = interp.cur_module.find_module(name)
|
|
19
19
|
unless mod
|
|
20
|
-
mod = ForthicModule.new(
|
|
20
|
+
mod = ForthicModule.new(name)
|
|
21
21
|
interp.cur_module.register_module(mod.name, mod.name, mod)
|
|
22
22
|
|
|
23
23
|
# If we're at the app module, also register with interpreter
|
|
@@ -28,4 +28,4 @@ module Forthic
|
|
|
28
28
|
interp.module_stack_push(mod)
|
|
29
29
|
end
|
|
30
30
|
end
|
|
31
|
-
end
|
|
31
|
+
end
|
data/lib/forthic/words/word.rb
CHANGED
data/lib/forthic.rb
CHANGED
|
@@ -3,23 +3,27 @@
|
|
|
3
3
|
require_relative "forthic/version"
|
|
4
4
|
|
|
5
5
|
module Forthic
|
|
6
|
-
autoload :Tokenizer,
|
|
7
|
-
autoload :CodeLocation,
|
|
8
|
-
autoload :Token,
|
|
9
|
-
autoload :PositionedString,
|
|
10
|
-
autoload :ForthicError,
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
autoload :
|
|
16
|
-
autoload :
|
|
17
|
-
autoload :
|
|
18
|
-
autoload :
|
|
19
|
-
autoload :
|
|
20
|
-
autoload :
|
|
21
|
-
autoload :
|
|
22
|
-
autoload :
|
|
23
|
-
autoload :
|
|
24
|
-
autoload :
|
|
6
|
+
autoload :Tokenizer, "forthic/tokenizer"
|
|
7
|
+
autoload :CodeLocation, "forthic/code_location"
|
|
8
|
+
autoload :Token, "forthic/token"
|
|
9
|
+
autoload :PositionedString, "forthic/positioned_string"
|
|
10
|
+
autoload :ForthicError, "forthic/forthic_error"
|
|
11
|
+
|
|
12
|
+
module Errors
|
|
13
|
+
autoload :UnknownWordError, "forthic/errors/unknown_word_error"
|
|
14
|
+
end
|
|
15
|
+
autoload :Word, "forthic/words/word"
|
|
16
|
+
autoload :PushValueWord, "forthic/words/push_value_word"
|
|
17
|
+
autoload :DefinitionWord, "forthic/words/definition_word"
|
|
18
|
+
autoload :ModuleMemoWord, "forthic/words/module_memo_word"
|
|
19
|
+
autoload :ModuleMemoBangAtWord, "forthic/words/module_memo_bang_at_word"
|
|
20
|
+
autoload :ModuleMemoBangWord, "forthic/words/module_memo_bang_word"
|
|
21
|
+
autoload :ModuleMemoBangAtWord, "forthic/words/module_memo_bang_at_word"
|
|
22
|
+
autoload :EndArrayWord, "forthic/words/end_array_word"
|
|
23
|
+
autoload :StartModuleWord, "forthic/words/start_module_word"
|
|
24
|
+
autoload :EndModuleWord, "forthic/words/end_module_word"
|
|
25
|
+
autoload :MapWord, "forthic/words/map_word"
|
|
26
|
+
autoload :ForthicModule, "forthic/forthic_module"
|
|
27
|
+
autoload :GlobalModule, "forthic/global_module"
|
|
28
|
+
autoload :Interpreter, "forthic/interpreter"
|
|
25
29
|
end
|
metadata
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: forthic
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Rino Jose
|
|
8
|
+
autorequire:
|
|
8
9
|
bindir: exe
|
|
9
10
|
cert_chain: []
|
|
10
|
-
date:
|
|
11
|
+
date: 2026-01-01 00:00:00.000000000 Z
|
|
11
12
|
dependencies: []
|
|
12
|
-
description: This package provides a Forthic interpreter that allows you
|
|
13
|
-
Forthic code within your Ruby projects. Forthic is a stack-based programming
|
|
14
|
-
inspired by Forth.
|
|
13
|
+
description: "[ARCHIVED] This package provides a Forthic interpreter that allows you
|
|
14
|
+
to execute Forthic code within your Ruby projects. Forthic is a stack-based programming
|
|
15
|
+
language inspired by Forth. This gem is from an archived repository. Please see
|
|
16
|
+
https://github.com/forthix/forthic-rb for the new official repository."
|
|
15
17
|
email:
|
|
16
18
|
- rjose@forthix.com
|
|
17
19
|
executables: []
|
|
@@ -20,11 +22,13 @@ extra_rdoc_files: []
|
|
|
20
22
|
files:
|
|
21
23
|
- ".standard.yml"
|
|
22
24
|
- CHANGELOG.md
|
|
25
|
+
- CLAUDE.md
|
|
23
26
|
- Guardfile
|
|
24
27
|
- README.md
|
|
25
28
|
- Rakefile
|
|
26
29
|
- lib/forthic.rb
|
|
27
30
|
- lib/forthic/code_location.rb
|
|
31
|
+
- lib/forthic/errors/unknown_word_error.rb
|
|
28
32
|
- lib/forthic/forthic_error.rb
|
|
29
33
|
- lib/forthic/forthic_module.rb
|
|
30
34
|
- lib/forthic/global_module.rb
|
|
@@ -47,11 +51,16 @@ files:
|
|
|
47
51
|
- lib/forthic/words/start_module_word.rb
|
|
48
52
|
- lib/forthic/words/word.rb
|
|
49
53
|
- sig/forthic.rbs
|
|
50
|
-
homepage: https://github.com/
|
|
54
|
+
homepage: https://github.com/forthix/forthic-rb
|
|
51
55
|
licenses: []
|
|
52
56
|
metadata:
|
|
53
|
-
homepage_uri: https://github.com/
|
|
54
|
-
source_code_uri: https://github.com/
|
|
57
|
+
homepage_uri: https://github.com/forthix/forthic-rb
|
|
58
|
+
source_code_uri: https://github.com/forthix/forthic-rb
|
|
59
|
+
post_install_message: |
|
|
60
|
+
⚠️ NOTICE: This gem is from an archived repository.
|
|
61
|
+
|
|
62
|
+
The Forthic project has moved to: https://github.com/forthix/forthic-rb
|
|
63
|
+
Please visit the new repository for updates and support.
|
|
55
64
|
rdoc_options: []
|
|
56
65
|
require_paths:
|
|
57
66
|
- lib
|
|
@@ -66,7 +75,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
66
75
|
- !ruby/object:Gem::Version
|
|
67
76
|
version: '0'
|
|
68
77
|
requirements: []
|
|
69
|
-
rubygems_version: 3.
|
|
78
|
+
rubygems_version: 3.3.26
|
|
79
|
+
signing_key:
|
|
70
80
|
specification_version: 4
|
|
71
|
-
summary: A Forthic interpreter that runs within Ruby.
|
|
81
|
+
summary: "[ARCHIVED] A Forthic interpreter that runs within Ruby - See https://github.com/forthix/forthic-rb"
|
|
72
82
|
test_files: []
|