forthic 0.1.0 → 0.2.0
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/Rakefile +1 -1
- data/lib/forthic/forthic_error.rb +1 -2
- data/lib/forthic/forthic_module.rb +10 -9
- data/lib/forthic/global_module.rb +321 -334
- data/lib/forthic/interpreter.rb +204 -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 +19 -19
- metadata +7 -3
@@ -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,23 @@
|
|
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
|
-
autoload :Word,
|
12
|
-
autoload :PushValueWord,
|
13
|
-
autoload :DefinitionWord,
|
14
|
-
autoload :ModuleMemoWord,
|
15
|
-
autoload :ModuleMemoBangAtWord,
|
16
|
-
autoload :ModuleMemoBangWord,
|
17
|
-
autoload :ModuleMemoBangAtWord,
|
18
|
-
autoload :EndArrayWord,
|
19
|
-
autoload :StartModuleWord,
|
20
|
-
autoload :EndModuleWord,
|
21
|
-
autoload :MapWord,
|
22
|
-
autoload :ForthicModule,
|
23
|
-
autoload :GlobalModule,
|
24
|
-
autoload :Interpreter,
|
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
|
+
autoload :Word, "forthic/words/word"
|
12
|
+
autoload :PushValueWord, "forthic/words/push_value_word"
|
13
|
+
autoload :DefinitionWord, "forthic/words/definition_word"
|
14
|
+
autoload :ModuleMemoWord, "forthic/words/module_memo_word"
|
15
|
+
autoload :ModuleMemoBangAtWord, "forthic/words/module_memo_bang_at_word"
|
16
|
+
autoload :ModuleMemoBangWord, "forthic/words/module_memo_bang_word"
|
17
|
+
autoload :ModuleMemoBangAtWord, "forthic/words/module_memo_bang_at_word"
|
18
|
+
autoload :EndArrayWord, "forthic/words/end_array_word"
|
19
|
+
autoload :StartModuleWord, "forthic/words/start_module_word"
|
20
|
+
autoload :EndModuleWord, "forthic/words/end_module_word"
|
21
|
+
autoload :MapWord, "forthic/words/map_word"
|
22
|
+
autoload :ForthicModule, "forthic/forthic_module"
|
23
|
+
autoload :GlobalModule, "forthic/global_module"
|
24
|
+
autoload :Interpreter, "forthic/interpreter"
|
25
25
|
end
|
metadata
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: forthic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rino Jose
|
8
|
+
autorequire:
|
8
9
|
bindir: exe
|
9
10
|
cert_chain: []
|
10
|
-
date: 2025-
|
11
|
+
date: 2025-07-13 00:00:00.000000000 Z
|
11
12
|
dependencies: []
|
12
13
|
description: This package provides a Forthic interpreter that allows you to execute
|
13
14
|
Forthic code within your Ruby projects. Forthic is a stack-based programming language
|
@@ -20,6 +21,7 @@ extra_rdoc_files: []
|
|
20
21
|
files:
|
21
22
|
- ".standard.yml"
|
22
23
|
- CHANGELOG.md
|
24
|
+
- CLAUDE.md
|
23
25
|
- Guardfile
|
24
26
|
- README.md
|
25
27
|
- Rakefile
|
@@ -52,6 +54,7 @@ licenses: []
|
|
52
54
|
metadata:
|
53
55
|
homepage_uri: https://github.com/linkedin/forthic
|
54
56
|
source_code_uri: https://github.com/linkedin/forthic
|
57
|
+
post_install_message:
|
55
58
|
rdoc_options: []
|
56
59
|
require_paths:
|
57
60
|
- lib
|
@@ -66,7 +69,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
66
69
|
- !ruby/object:Gem::Version
|
67
70
|
version: '0'
|
68
71
|
requirements: []
|
69
|
-
rubygems_version: 3.
|
72
|
+
rubygems_version: 3.3.26
|
73
|
+
signing_key:
|
70
74
|
specification_version: 4
|
71
75
|
summary: A Forthic interpreter that runs within Ruby.
|
72
76
|
test_files: []
|