kolom 1.0.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 8084dc8f75a72f28ad9212eafe9a387ca383eb5fd1ab71fda1c4107fd50814bb
4
+ data.tar.gz: d8fcac58ab1e568ac42ccd5cfd228fdd892fa6d626c458dde04734c15c27410f
5
+ SHA512:
6
+ metadata.gz: 9f9c4d2d4e6c2372c0b3aaab54044f85994588a524509f02992d4f1be3b6eaba1e0590ea7c38e20f523110ded125934c2340dc00a57f38d708ef95ebea466d39
7
+ data.tar.gz: 1d909743efb103685499c7d11de05fcb93aa72af982307c333ed7dba7abcaaa253f8756cadc5bb4c1f5ccbd3f2a91e51504a62919f6a6f49bf3e963895ec1087
data/.rubocop.yml ADDED
@@ -0,0 +1,8 @@
1
+ AllCops:
2
+ TargetRubyVersion: 3.1
3
+
4
+ Style/StringLiterals:
5
+ EnforcedStyle: double_quotes
6
+
7
+ Style/StringLiteralsInInterpolation:
8
+ EnforcedStyle: double_quotes
@@ -0,0 +1,132 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our
6
+ community a harassment-free experience for everyone, regardless of age, body
7
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
8
+ identity and expression, level of experience, education, socio-economic status,
9
+ nationality, personal appearance, race, caste, color, religion, or sexual
10
+ identity and orientation.
11
+
12
+ We pledge to act and interact in ways that contribute to an open, welcoming,
13
+ diverse, inclusive, and healthy community.
14
+
15
+ ## Our Standards
16
+
17
+ Examples of behavior that contributes to a positive environment for our
18
+ community include:
19
+
20
+ * Demonstrating empathy and kindness toward other people
21
+ * Being respectful of differing opinions, viewpoints, and experiences
22
+ * Giving and gracefully accepting constructive feedback
23
+ * Accepting responsibility and apologizing to those affected by our mistakes,
24
+ and learning from the experience
25
+ * Focusing on what is best not just for us as individuals, but for the overall
26
+ community
27
+
28
+ Examples of unacceptable behavior include:
29
+
30
+ * The use of sexualized language or imagery, and sexual attention or advances of
31
+ any kind
32
+ * Trolling, insulting or derogatory comments, and personal or political attacks
33
+ * Public or private harassment
34
+ * Publishing others' private information, such as a physical or email address,
35
+ without their explicit permission
36
+ * Other conduct which could reasonably be considered inappropriate in a
37
+ professional setting
38
+
39
+ ## Enforcement Responsibilities
40
+
41
+ Community leaders are responsible for clarifying and enforcing our standards of
42
+ acceptable behavior and will take appropriate and fair corrective action in
43
+ response to any behavior that they deem inappropriate, threatening, offensive,
44
+ or harmful.
45
+
46
+ Community leaders have the right and responsibility to remove, edit, or reject
47
+ comments, commits, code, wiki edits, issues, and other contributions that are
48
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
49
+ decisions when appropriate.
50
+
51
+ ## Scope
52
+
53
+ This Code of Conduct applies within all community spaces, and also applies when
54
+ an individual is officially representing the community in public spaces.
55
+ Examples of representing our community include using an official email address,
56
+ posting via an official social media account, or acting as an appointed
57
+ representative at an online or offline event.
58
+
59
+ ## Enforcement
60
+
61
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
62
+ reported to the community leaders responsible for enforcement at
63
+ [INSERT CONTACT METHOD].
64
+ All complaints will be reviewed and investigated promptly and fairly.
65
+
66
+ All community leaders are obligated to respect the privacy and security of the
67
+ reporter of any incident.
68
+
69
+ ## Enforcement Guidelines
70
+
71
+ Community leaders will follow these Community Impact Guidelines in determining
72
+ the consequences for any action they deem in violation of this Code of Conduct:
73
+
74
+ ### 1. Correction
75
+
76
+ **Community Impact**: Use of inappropriate language or other behavior deemed
77
+ unprofessional or unwelcome in the community.
78
+
79
+ **Consequence**: A private, written warning from community leaders, providing
80
+ clarity around the nature of the violation and an explanation of why the
81
+ behavior was inappropriate. A public apology may be requested.
82
+
83
+ ### 2. Warning
84
+
85
+ **Community Impact**: A violation through a single incident or series of
86
+ actions.
87
+
88
+ **Consequence**: A warning with consequences for continued behavior. No
89
+ interaction with the people involved, including unsolicited interaction with
90
+ those enforcing the Code of Conduct, for a specified period of time. This
91
+ includes avoiding interactions in community spaces as well as external channels
92
+ like social media. Violating these terms may lead to a temporary or permanent
93
+ ban.
94
+
95
+ ### 3. Temporary Ban
96
+
97
+ **Community Impact**: A serious violation of community standards, including
98
+ sustained inappropriate behavior.
99
+
100
+ **Consequence**: A temporary ban from any sort of interaction or public
101
+ communication with the community for a specified period of time. No public or
102
+ private interaction with the people involved, including unsolicited interaction
103
+ with those enforcing the Code of Conduct, is allowed during this period.
104
+ Violating these terms may lead to a permanent ban.
105
+
106
+ ### 4. Permanent Ban
107
+
108
+ **Community Impact**: Demonstrating a pattern of violation of community
109
+ standards, including sustained inappropriate behavior, harassment of an
110
+ individual, or aggression toward or disparagement of classes of individuals.
111
+
112
+ **Consequence**: A permanent ban from any sort of public interaction within the
113
+ community.
114
+
115
+ ## Attribution
116
+
117
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118
+ version 2.1, available at
119
+ [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
120
+
121
+ Community Impact Guidelines were inspired by
122
+ [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
123
+
124
+ For answers to common questions about this code of conduct, see the FAQ at
125
+ [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
126
+ [https://www.contributor-covenant.org/translations][translations].
127
+
128
+ [homepage]: https://www.contributor-covenant.org
129
+ [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
130
+ [Mozilla CoC]: https://github.com/mozilla/diversity
131
+ [FAQ]: https://www.contributor-covenant.org/faq
132
+ [translations]: https://www.contributor-covenant.org/translations
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2025 smakthe
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,192 @@
1
+ # কলম Language
2
+
3
+ কলম (Kolom) is a toy scripting language that uses Bengali keywords instead of English. It's implemented as a Ruby gem and compiles to Ruby, leveraging Ruby's powerful metaprogramming capabilities.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ gem install kolom
9
+ ```
10
+
11
+ Or add this line to your application's Gemfile:
12
+
13
+ ```ruby
14
+ gem 'kolom'
15
+ ```
16
+
17
+ And then execute:
18
+
19
+ ```bash
20
+ bundle install
21
+ ```
22
+
23
+ ## Usage
24
+
25
+ ### Running কলম Programs
26
+
27
+ You can run a কলম script file:
28
+
29
+ ```bash
30
+ kolom path/to/your/script.kl
31
+ ```
32
+
33
+ Or execute কলম code directly:
34
+
35
+ ```bash
36
+ kolom -e 'লেখো "নমস্কার বিশ্ব!"'
37
+ ```
38
+
39
+ ### Using the REPL
40
+
41
+ You can start an interactive REPL:
42
+
43
+ ```bash
44
+ kolom
45
+ ```
46
+
47
+ ### Example Program
48
+
49
+ Here's a simple example of a কলম program:
50
+
51
+ ```
52
+ # Conditional logic
53
+ যদি সংখ্যাসমষ্টি.আকার > 3
54
+ বলো("অনেক সংখ্যা আছে!")
55
+ নইলে
56
+ বলো("অল্প সংখ্যা আছে।")
57
+ শেষ
58
+
59
+ # String methods
60
+ বাক্য = "বাংলা ভাষা"
61
+ বাক্য = বাক্য.সংযোগ(" সুন্দর")
62
+ বলো বাক্য
63
+ লেখো("শব্দ গণনা: #{বাক্য.বিভাগ(' ').আকার}\n")
64
+ ```
65
+
66
+ ### Common Methods
67
+
68
+ Use of common methods in a কলম program:
69
+
70
+ ```
71
+ # Array operations
72
+ সংখ্যাসমষ্টি = [1, 2, 3, 4, 5]
73
+ লেখো("সংখ্যাসমষ্টি: #{সংখ্যাসমষ্টি}\n")
74
+ বলো("প্রথম সংখ্যা: #{সংখ্যাসমষ্টি[0]}")
75
+
76
+ # Loop through array
77
+ সংখ্যাসমষ্টি.প্রত্যেক কর |ন|
78
+ লেখো("#{ন} এর বর্গ: #{ন * ন}\n")
79
+ শেষ
80
+
81
+ # Using map (প্রয়োগ)
82
+ দ্বিগুণ = সংখ্যাসমষ্টি.প্রয়োগ কর |ন|
83
+ ন * 2
84
+ শেষ
85
+
86
+ বলো("দ্বিগুণ সংখ্যা: #{দ্বিগুণ}")
87
+
88
+ # Hash operations
89
+ ফল = {
90
+ "আপেল" => "লাল",
91
+ "কলা" => "হলুদ",
92
+ "আঙ্গুর" => "বেগুনি"
93
+ }
94
+
95
+ বলো("রঙ:")
96
+ ফল.প্রত্যেক_চাবি কর |নাম|
97
+ লেখো("#{নাম}: #{ফল[নাম]}\n")
98
+ শেষ
99
+
100
+ # Function definition
101
+ সংজ্ঞা যোগফল(ক, খ)
102
+ ক + খ
103
+ শেষ
104
+
105
+ লেখো("যোগফল: #{যোগফল(5, 7)}")
106
+ ```
107
+
108
+ ### Object Oriented Programming
109
+
110
+ We can also perform Object Oriented Programming in a কলম program:
111
+
112
+ ```
113
+ # Define a class
114
+ শ্রেণী ব্যক্তি
115
+ সংজ্ঞা সংস্থাপন(নাম, বয়স)
116
+ @নাম = নাম
117
+ @বয়স = বয়স
118
+ শেষ
119
+
120
+ সংজ্ঞা পরিচয়_দাও
121
+ লেখো("আমার নাম #{@নাম} এবং আমার বয়স #{@বয়স} বছর।")
122
+ শেষ
123
+ শ্রেণী
124
+
125
+ # Create an instance
126
+ আমি = ব্যক্তি.নতুন("করিম", 30)
127
+ আমি.পরিচয়_দাও
128
+ ```
129
+
130
+ ## Keywords and Methods
131
+
132
+ কলম provides Bengali equivalents for common Ruby keywords and methods:
133
+
134
+ ### Keywords
135
+
136
+ | Kolom | Ruby |
137
+ |---------|------|
138
+ | শ্রেণী | class |
139
+ | সংজ্ঞা | def |
140
+ | যদি | if |
141
+ | নইলে | else |
142
+ | তাহলে | then |
143
+ | কর | do |
144
+ | জন্য | for |
145
+ | যখন | when |
146
+ | ও | and |
147
+ | বা | or |
148
+ | না | not |
149
+ | সত্য | true |
150
+ | মিথ্যা | false |
151
+ | ফেরত | return |
152
+
153
+ ### Methods
154
+
155
+ | Kolom | Ruby |
156
+ |---------|------|
157
+ | লেখো | print |
158
+ | দৈর্ঘ্য | length |
159
+ | সংযোগ | concat |
160
+ | বিভাগ | split |
161
+ | নিবেশ | push |
162
+ | নিরসন | pop |
163
+ | সম্বদ্ধ | join |
164
+ | প্রয়োগ | map |
165
+ | প্রত্যেক | each |
166
+ | আকার | size |
167
+
168
+ ## Features
169
+
170
+ - Translation of Bengali keywords to Ruby equivalents
171
+ - Support for core Ruby types (String, Array, Hash)
172
+ - Dynamic method handling using metaprogramming
173
+ - Interactive REPL with command history
174
+ - Support for file-based scripts
175
+ - Error handling and debugging
176
+
177
+ ## Advanced Features
178
+
179
+ - Dynamic method definition
180
+ - Method aliasing in Bengali
181
+ - Method tracing for debugging
182
+ - DSL support
183
+ - Lazy evaluation using Fiber
184
+ - Concurrent execution with Threads
185
+
186
+ ## Contributing
187
+
188
+ Bug reports and pull requests are welcome on GitHub.
189
+
190
+ ## License
191
+
192
+ The gem is available as open source under the terms of the MIT License.
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rubocop/rake_task"
5
+
6
+ RuboCop::RakeTask.new
7
+
8
+ task default: :rubocop
@@ -0,0 +1,64 @@
1
+ module Kolom
2
+ module CoreExtensions
3
+ # Define extensions for String class
4
+ module StringMethods
5
+ def method_missing(method_name, *args, &block)
6
+ bengali_method = Kolom::KEYWORDS.key(method_name.to_s)
7
+ if bengali_method
8
+ send(Kolom::KEYWORDS[bengali_method].to_sym, *args, &block)
9
+ else
10
+ super
11
+ end
12
+ end
13
+
14
+ def respond_to_missing?(method_name, include_private = false)
15
+ Kolom::KEYWORDS.key(method_name.to_s) || super
16
+ end
17
+ end
18
+
19
+ # Define extensions for Array class
20
+ module ArrayMethods
21
+ def method_missing(method_name, *args, &block)
22
+ bengali_method = Kolom::KEYWORDS.key(method_name.to_s)
23
+ if bengali_method
24
+ send(Kolom::KEYWORDS[bengali_method].to_sym, *args, &block)
25
+ else
26
+ super
27
+ end
28
+ end
29
+
30
+ def respond_to_missing?(method_name, include_private = false)
31
+ Kolom::KEYWORDS.key(method_name.to_s) || super
32
+ end
33
+ end
34
+
35
+ # Define extensions for Hash class
36
+ module HashMethods
37
+ def method_missing(method_name, *args, &block)
38
+ bengali_method = Kolom::KEYWORDS.key(method_name.to_s)
39
+ if bengali_method
40
+ send(Kolom::KEYWORDS[bengali_method].to_sym, *args, &block)
41
+ else
42
+ super
43
+ end
44
+ end
45
+
46
+ def respond_to_missing?(method_name, include_private = false)
47
+ Kolom::KEYWORDS.key(method_name.to_s) || super
48
+ end
49
+ end
50
+ end
51
+ end
52
+
53
+ # Extend core Ruby classes to respond to Bengali method names
54
+ class String
55
+ include Kolom::CoreExtensions::StringMethods
56
+ end
57
+
58
+ class Array
59
+ include Kolom::CoreExtensions::ArrayMethods
60
+ end
61
+
62
+ class Hash
63
+ include Kolom::CoreExtensions::HashMethods
64
+ end
@@ -0,0 +1,71 @@
1
+ {
2
+ "ও" : "and",
3
+ "ভাঙ্গা" : "break",
4
+ "ঘটনা" : "case",
5
+ "শ্রেণী" : "class",
6
+ "নতুন": "new",
7
+ "সংজ্ঞা" : "def",
8
+ "সংজ্ঞায়িত?" : "defined?",
9
+ "সংস্থাপন" : "initialize",
10
+ "কর" : "do",
11
+ "নইলে" : "else",
12
+ "অন্যথা" : "elsif",
13
+ "শেষ" : "end",
14
+ "নিশ্চিত" : "ensure",
15
+ "মিথ্যা" : "false",
16
+ "জন্য" : "for",
17
+ "যদি" : "if",
18
+ "মধ্যে" : "in",
19
+ "কক্ষ" : "module",
20
+ "পরবর্তী" : "next",
21
+ "শূন্য" : "nil",
22
+ "না" : "not",
23
+ "বা" : "or",
24
+ "পুনরায়" : "redo",
25
+ "উদ্ধার" : "rescue",
26
+ "পুনঃচেষ্টা" : "retry",
27
+ "ফেরত" : "return",
28
+ "স্বয়ং" : "self",
29
+ "অতি" : "super",
30
+ "সত্য" : "true",
31
+ "অসংজ্ঞায়িত" : "undef",
32
+ "যদিনা" : "unless",
33
+ "যতক্ষণনা" : "until",
34
+ "যখন" : "when",
35
+ "যতক্ষণ" : "while",
36
+ "প্রদান" : "yield",
37
+ "লেখো" : "print",
38
+ "বলো" : "puts",
39
+ "দৈর্ঘ্য" : "length",
40
+ "উল্টো" : "reverse",
41
+ "সংযোগ" : "concat",
42
+ "বিভাগ" : "split",
43
+ "ছাঁট" : "strip",
44
+ "বদল" : "gsub",
45
+ "অন্তর্ভুক্ত?" : "include?",
46
+ "আকার" : "size",
47
+ "নিবেশ" : "push",
48
+ "নিরসন" : "pop",
49
+ "প্রাগ্নিবেশ" : "shift",
50
+ "প্রাগ্নিরসন" : "unshift",
51
+ "সম্বদ্ধ" : "join",
52
+ "সাজানো" : "sort",
53
+ "সূচক" : "index",
54
+ "নির্বাচন" : "select",
55
+ "বাতিল" : "reject",
56
+ "প্রয়োগ" : "map",
57
+ "সংগ্রহ" : "collect",
58
+ "সমতল" : "flatten",
59
+ "চাবি" : "keys",
60
+ "মান" : "values",
61
+ "চাবি_আছে?" : "has_key?",
62
+ "চাবি?" : "key?",
63
+ "মান_আছে?" : "has_value?",
64
+ "আন" : "fetch",
65
+ "নাশ" : "delete",
66
+ "একত্র" : "merge",
67
+ "প্রত্যেক" : "each",
68
+ "প্রত্যেক_চাবি" : "each_key",
69
+ "প্রত্যেক_মান" : "each_value",
70
+ "খালি?" : "empty?"
71
+ }
@@ -0,0 +1,61 @@
1
+ module Kolom
2
+ # Advanced features for metaprogramming
3
+ module MetaProgramming
4
+ # Dynamic method generation
5
+ def self.define_dynamic_method(obj, method_name, &block)
6
+ obj.define_singleton_method(method_name, &block)
7
+ end
8
+
9
+ # Method aliasing in Bengali
10
+ def self.create_alias(obj, new_name, old_name)
11
+ obj.singleton_class.class_eval do
12
+ alias_method new_name.to_sym, old_name.to_sym
13
+ end
14
+ end
15
+
16
+ # Method tracing for debugging
17
+ def self.trace_method(klass, method_name)
18
+ original_method = klass.instance_method(method_name)
19
+
20
+ klass.class_eval do
21
+ define_method(method_name) do |*args, &block|
22
+ puts "Calling: #{method_name} with #{args.inspect}"
23
+ result = original_method.bind(self).call(*args, &block)
24
+ puts "Result: #{result.inspect}"
25
+ result
26
+ end
27
+ end
28
+ end
29
+
30
+ # DSL support
31
+ class DSLContext
32
+ def initialize
33
+ @data = {}
34
+ end
35
+
36
+ def method_missing(method_name, *args, &block)
37
+ if block_given?
38
+ @data[method_name] = instance_exec(&block)
39
+ elsif args.size > 0
40
+ @data[method_name] = args.size == 1 ? args.first : args
41
+ else
42
+ @data[method_name]
43
+ end
44
+ end
45
+
46
+ def respond_to_missing?(method_name, include_private = false)
47
+ true
48
+ end
49
+
50
+ def evaluate(&block)
51
+ instance_eval(&block)
52
+ @data
53
+ end
54
+ end
55
+
56
+ def self.create_dsl(&block)
57
+ context = DSLContext.new
58
+ context.evaluate(&block)
59
+ end
60
+ end
61
+ end
data/lib/kolom/repl.rb ADDED
@@ -0,0 +1,31 @@
1
+ require 'readline'
2
+
3
+ module Kolom
4
+ class REPL
5
+
6
+ def initialize
7
+ @interpreter = Interpreter.new
8
+ @history = []
9
+ end
10
+
11
+ def start
12
+ loop do
13
+ line = Readline.readline("কলম> ", true)
14
+ break if line.nil? || line.strip == 'বাহির'
15
+
16
+ begin
17
+ result, output = @interpreter.evaluate(line)
18
+ puts output unless output.empty?
19
+ puts "=> #{result.inspect}" unless result.nil?
20
+ rescue => e
21
+ puts "Error: #{e.message}"
22
+ puts e.backtrace.join("\n")
23
+ end
24
+
25
+ @history << line
26
+ end
27
+
28
+ puts "ধন্যবাদ!"
29
+ end
30
+ end
31
+ end
data/lib/kolom.rb ADDED
@@ -0,0 +1,61 @@
1
+ require "json"
2
+ require "stringio"
3
+
4
+ # Kolom is a Ruby interpreter that allows you to write Ruby-like code using Bengali keywords.
5
+ module Kolom
6
+ VERSION = ENV["KOLUM_VERSION"] || "0.1.0"
7
+
8
+ # Bengali translations of Ruby keywords
9
+ keymap_filepath = File.join(File.dirname(__FILE__), "kolom/keymap.json")
10
+ keymap_file = File.open(keymap_filepath)
11
+ KEYWORDS = JSON.load(keymap_file).freeze
12
+
13
+ # Inverse mapping for translating back
14
+ RUBY_KEYWORDS = KEYWORDS.invert
15
+
16
+ # Load all files in the kolom directory
17
+ Dir.glob(File.join(__dir__, "kolom", "*.rb")).each do |file_path|
18
+ # Construct the relative path like "kolom/filename" and require it
19
+
20
+ require_relative File.join("kolom", File.basename(file_path, ".rb"))
21
+ rescue LoadError => e
22
+ warn "Failed to load #{File.join("kolom", File.basename(file_path, ".rb"))}: #{e.message}"
23
+ end
24
+
25
+ # The Interpreter class is responsible for executing the translated Ruby code.
26
+ class Interpreter
27
+ attr_reader :env, :output
28
+
29
+ def initialize
30
+ @env = {}
31
+ @output = StringIO.new
32
+ # setup_global_environment
33
+ end
34
+
35
+ def evaluate(code)
36
+ ruby_code = translate_to_ruby(code)
37
+
38
+ # Create an instance of DSLContext
39
+ dsl_context = Kolom::MetaProgramming::DSLContext.new
40
+
41
+ # Evaluate the translated code in the DSL context
42
+ result = dsl_context.instance_eval(ruby_code)
43
+
44
+ # Return the result and any output
45
+ [result, @output.string]
46
+ end
47
+
48
+ def translate_to_ruby(code)
49
+ # This is a simple token-based translation
50
+ # In a real implementation, a proper parser might be used
51
+
52
+ # Replace Bengali keywords with Ruby keywords
53
+ KEYWORDS.each do |bengali, ruby|
54
+ # We need to be careful with word boundaries
55
+ code = code.gsub(/\b#{bengali}\b/, ruby)
56
+ end
57
+
58
+ code
59
+ end
60
+ end
61
+ end
data/sig/kolom.rbs ADDED
File without changes
metadata ADDED
@@ -0,0 +1,53 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: kolom
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - smakthe
8
+ bindir: bin
9
+ cert_chain: []
10
+ date: 2025-04-06 00:00:00.000000000 Z
11
+ dependencies: []
12
+ description: A toy scripting language with Bengali keywords that compiles to Ruby
13
+ email:
14
+ - scmakra99@gmail.com
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - ".rubocop.yml"
20
+ - CODE_OF_CONDUCT.md
21
+ - LICENSE.txt
22
+ - README.md
23
+ - Rakefile
24
+ - lib/kolom.rb
25
+ - lib/kolom/core_extensions.rb
26
+ - lib/kolom/keymap.json
27
+ - lib/kolom/metaprogramming.rb
28
+ - lib/kolom/repl.rb
29
+ - sig/kolom.rbs
30
+ homepage: https://github.com/smakthe/kolom
31
+ licenses:
32
+ - MIT
33
+ metadata:
34
+ allowed_push_host: https://rubygems.org
35
+ homepage_uri: https://github.com/smakthe/kolom
36
+ rdoc_options: []
37
+ require_paths:
38
+ - lib
39
+ required_ruby_version: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: 3.1.0
44
+ required_rubygems_version: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
49
+ requirements: []
50
+ rubygems_version: 3.6.5
51
+ specification_version: 4
52
+ summary: কলম - A Bengali scripting language
53
+ test_files: []