uyirmei 0.0.1

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: '090cbee88d65eec13a9196255f8b00d420be8eb5'
4
+ data.tar.gz: fc778deac6571380cdd94378188e3cdc379026af
5
+ SHA512:
6
+ metadata.gz: 4ff7d4ed147ad78276edbe8043af0f782a4cc6699371bd146cdde52a261d02033922b3984feb12dfa42d575b803508f05447a506f896b872de55b820170122c8
7
+ data.tar.gz: 295d7a74134629ad47b315e498175b851bbd3544bef9632e83b83ec65458c4b636b83bf214eb0ce99208b7e0f0fcbe9c017a0fe403320df601932a23f9e6914b
@@ -0,0 +1 @@
1
+ .idea/
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source 'https://rubygems.org'
2
+ gemspec
@@ -0,0 +1,68 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ uyirmei (0.0.1)
5
+ gli (= 2.16.0)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ aruba (0.14.2)
11
+ childprocess (~> 0.5.6)
12
+ contracts (~> 0.9)
13
+ cucumber (>= 1.3.19)
14
+ ffi (~> 1.9.10)
15
+ rspec-expectations (>= 2.99)
16
+ thor (~> 0.19)
17
+ builder (3.2.3)
18
+ byebug (9.0.6)
19
+ childprocess (0.5.9)
20
+ ffi (~> 1.0, >= 1.0.11)
21
+ coderay (1.1.1)
22
+ contracts (0.16.0)
23
+ cucumber (2.4.0)
24
+ builder (>= 2.1.2)
25
+ cucumber-core (~> 1.5.0)
26
+ cucumber-wire (~> 0.0.1)
27
+ diff-lcs (>= 1.1.3)
28
+ gherkin (~> 4.0)
29
+ multi_json (>= 1.7.5, < 2.0)
30
+ multi_test (>= 0.1.2)
31
+ cucumber-core (1.5.0)
32
+ gherkin (~> 4.0)
33
+ cucumber-wire (0.0.1)
34
+ diff-lcs (1.3)
35
+ ffi (1.9.18)
36
+ gherkin (4.1.3)
37
+ gli (2.16.0)
38
+ method_source (0.8.2)
39
+ multi_json (1.12.1)
40
+ multi_test (0.1.2)
41
+ pry (0.10.4)
42
+ coderay (~> 1.1.0)
43
+ method_source (~> 0.8.1)
44
+ slop (~> 3.4)
45
+ pry-byebug (3.4.2)
46
+ byebug (~> 9.0)
47
+ pry (~> 0.10)
48
+ rake (12.0.0)
49
+ rdoc (5.1.0)
50
+ rspec-expectations (3.6.0)
51
+ diff-lcs (>= 1.2.0, < 2.0)
52
+ rspec-support (~> 3.6.0)
53
+ rspec-support (3.6.0)
54
+ slop (3.6.0)
55
+ thor (0.19.4)
56
+
57
+ PLATFORMS
58
+ ruby
59
+
60
+ DEPENDENCIES
61
+ aruba
62
+ pry-byebug
63
+ rake
64
+ rdoc
65
+ uyirmei!
66
+
67
+ BUNDLED WITH
68
+ 1.14.6
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 RC
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 all
13
+ 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 THE
21
+ SOFTWARE.
@@ -0,0 +1,37 @@
1
+ # உயிர்மெய்
2
+
3
+ [Uyirmei: *The soul and body elements of the tamil language*]
4
+
5
+ > Experimental programming language in Tamizh
6
+
7
+ #### Why
8
+
9
+ This is an experimental side project to validate if a new language grammar can be supported with just ruby metaprogramming constructs. I have used all tricks and ruby hacks to check if a new language parser can be supported using a ruby executable. Consider this a starting point for programming language enthusiast to try to extend programming to other natural languages :)
10
+
11
+ #### Show me the code
12
+
13
+ Let us look at sample programs before introducing the *limited* language constructs formally..
14
+
15
+ 1. Determine if a number is odd or not
16
+
17
+ ![alt tag](https://raw.githubusercontent.com/rcdexta/uyirmei/master/assets/odd_even.png)
18
+
19
+ 2. Generate prime numbers upto n
20
+
21
+ ![alt tag](https://raw.githubusercontent.com/rcdexta/uyirmei/master/assets/prime.png)
22
+
23
+ Had to add screenshots since the language grammar is not supported by github. You can check out the code in the [examples](https://github.com/rcdexta/uyirmei/tree/master/examples) directory
24
+
25
+ #### Language constructs
26
+
27
+ | In Uyirmei | Equivalent keyword | Notes |
28
+ |---|---|---|
29
+ |சாற்று | let | Define a variable |
30
+ |வினை | function | Define a method/routine |
31
+ |எனில் | if | execute block if evaluates to true |
32
+ |இல்லைஎனில் | unless | execute block if evaluates to false |
33
+ | மீண்டும் | loop | execute given block till break |
34
+ | நிறுத்து | break | break out of loop if condition passes |
35
+ | அச்சு | print | print with a newline |
36
+ | மெய் | true | |
37
+ | பொய் | false | |
@@ -0,0 +1,44 @@
1
+ require 'rake/clean'
2
+ require 'rubygems'
3
+ require 'rubygems/package_task'
4
+ require 'rdoc/task'
5
+ require 'cucumber'
6
+ require 'cucumber/rake/task'
7
+ Rake::RDocTask.new do |rd|
8
+ rd.main = "README.rdoc"
9
+ rd.rdoc_files.include("README.rdoc","lib/**/*.rb","bin/**/*")
10
+ rd.title = 'Your application title'
11
+ end
12
+
13
+ spec = eval(File.read('uyirmei.gemspec'))
14
+
15
+ Gem::PackageTask.new(spec) do |pkg|
16
+ end
17
+ CUKE_RESULTS = 'results.html'
18
+ CLEAN << CUKE_RESULTS
19
+ desc 'Run features'
20
+ Cucumber::Rake::Task.new(:features) do |t|
21
+ opts = "features --format html -o #{CUKE_RESULTS} --format progress -x"
22
+ opts += " --tags #{ENV['TAGS']}" if ENV['TAGS']
23
+ t.cucumber_opts = opts
24
+ t.fork = false
25
+ end
26
+
27
+ desc 'Run features tagged as work-in-progress (@wip)'
28
+ Cucumber::Rake::Task.new('features:wip') do |t|
29
+ tag_opts = ' --tags ~@pending'
30
+ tag_opts = ' --tags @wip'
31
+ t.cucumber_opts = "features --format html -o #{CUKE_RESULTS} --format pretty -x -s#{tag_opts}"
32
+ t.fork = false
33
+ end
34
+
35
+ task :cucumber => :features
36
+ task 'cucumber:wip' => 'features:wip'
37
+ task :wip => 'features:wip'
38
+ require 'rake/testtask'
39
+ Rake::TestTask.new do |t|
40
+ t.libs << "test"
41
+ t.test_files = FileList['test/*_test.rb']
42
+ end
43
+
44
+ task :default => [:test,:features]
Binary file
Binary file
@@ -0,0 +1,61 @@
1
+ #!/usr/bin/env ruby
2
+ require 'gli'
3
+ begin # XXX: Remove this begin/rescue before distributing your app
4
+ require 'uyirmei'
5
+ rescue LoadError
6
+ STDERR.puts "In development, you need to use `bundle exec bin/uyirmei` to run your app"
7
+ STDERR.puts "At install-time, RubyGems will make sure lib, etc. are in the load path"
8
+ STDERR.puts "Feel free to remove this message from bin/uyirmei now"
9
+ exit 64
10
+ end
11
+
12
+ include GLI::App
13
+
14
+ program_desc 'Experimental programming language in Tamizh'
15
+
16
+ version Uyirmei::VERSION
17
+
18
+ subcommand_option_handling :normal
19
+ arguments :strict
20
+
21
+ desc 'Describe some switch here'
22
+ switch [:s,:switch]
23
+
24
+ desc 'Describe some flag here'
25
+ default_value 'the default'
26
+ arg_name 'The name of the argument'
27
+ flag [:f,:flagname]
28
+
29
+ pre do |global,command,options,args|
30
+ # Pre logic here
31
+ # Return true to proceed; false to abort and not call the
32
+ # chosen command
33
+ # Use skips_pre before a command to skip this block
34
+ # on that command only
35
+ true
36
+ end
37
+
38
+ desc 'Run a uyirmei program'
39
+ arg 'filename'
40
+ command :run do |c|
41
+ c.action do |global_options,options,args|
42
+ file_path = "#{Dir.pwd}/#{args[0]}"
43
+ UyirMeiLoader.execute file_path
44
+ end
45
+ end
46
+
47
+ post do |global,command,options,args|
48
+ # Post logic here
49
+ # Use skips_post before a command to skip this
50
+ # block on that command only
51
+ end
52
+
53
+ on_error do |exception|
54
+ # Error logic here
55
+ # return false to skip default error handling
56
+ puts exception
57
+ exception.backtrace.each { |line| puts line }
58
+ true
59
+ end
60
+
61
+ exit run(ARGV)
@@ -0,0 +1,7 @@
1
+ சாற்று ஒற்றை_இரட்டை_படை = வினை(எண்) {
2
+ எண் % 2 == 0 ? 'இரட்டை' : 'ஒற்றை'
3
+ }
4
+
5
+ அச்சு ஒற்றை_இரட்டை_படை(4)
6
+ அச்சு ஒற்றை_இரட்டை_படை(5)
7
+ அச்சு ஒற்றை_இரட்டை_படை(10)
@@ -0,0 +1,26 @@
1
+ சாற்று பகுக்கக்கூடிய = வினை(எண்) {
2
+ க = 2
3
+ விளைவு = பொய்
4
+ மீண்டும் {
5
+ எனில்(எண் % க == 0) {
6
+ விளைவு = மெய்
7
+ }
8
+ க = க + 1
9
+ நிறுத்து க >= எண் - 1
10
+ }
11
+ விளைவு
12
+ }
13
+
14
+ சாற்று பகா_எண்கள் = வினை(வரம்பு) {
15
+ ஐ = 2
16
+ மீண்டும் {
17
+ இல்லைஎனில் (பகுக்கக்கூடிய(ஐ)) {
18
+ அச்சு ஐ
19
+ }
20
+ ஐ = ஐ + 1
21
+ நிறுத்து ஐ > வரம்பு
22
+ }
23
+ }
24
+
25
+
26
+ அச்சு பகா_எண்கள்(15)
@@ -0,0 +1,6 @@
1
+ When /^I get help for "([^"]*)"$/ do |app_name|
2
+ @app_name = app_name
3
+ step %(I run `#{app_name} help`)
4
+ end
5
+
6
+ # Add more step definitions here
@@ -0,0 +1,15 @@
1
+ require 'aruba/cucumber'
2
+
3
+ ENV['PATH'] = "#{File.expand_path(File.dirname(__FILE__) + '/../../bin')}#{File::PATH_SEPARATOR}#{ENV['PATH']}"
4
+ LIB_DIR = File.join(File.expand_path(File.dirname(__FILE__)),'..','..','lib')
5
+
6
+ Before do
7
+ # Using "announce" causes massive warnings on 1.9.2
8
+ @puts = true
9
+ @original_rubylib = ENV['RUBYLIB']
10
+ ENV['RUBYLIB'] = LIB_DIR + File::PATH_SEPARATOR + ENV['RUBYLIB'].to_s
11
+ end
12
+
13
+ After do
14
+ ENV['RUBYLIB'] = @original_rubylib
15
+ end
@@ -0,0 +1,8 @@
1
+ Feature: My bootstrapped app kinda works
2
+ In order to get going on coding my awesome app
3
+ I want to have aruba and cucumber setup
4
+ So I don't have to do it myself
5
+
6
+ Scenario: App just runs
7
+ When I get help for "agaram"
8
+ Then the exit status should be 0
@@ -0,0 +1,21 @@
1
+ require 'uyirmei/version.rb'
2
+ class UyirMeiLoader
3
+
4
+ class << self
5
+
6
+ CORE_FILE = File.join(File.dirname(__FILE__), '/uyirmei/core.rb')
7
+ SRC = 'runner.rb'
8
+
9
+ def replace(file, word, with)
10
+ File.write(file,File.open(file,&:read).gsub(word,with))
11
+ end
12
+
13
+ def execute(file)
14
+ File.open(SRC,"w") { |f| f.puts [CORE_FILE, file].map{ |s| IO.read(s) }}
15
+ replace(SRC, 'பின்கொடு', 'return')
16
+ require "./#{SRC}"
17
+ File.delete(SRC)
18
+ end
19
+ end
20
+
21
+ end
@@ -0,0 +1,60 @@
1
+ module Kernel
2
+ def method_missing(*args)
3
+ skip_methods = %i(to_a to_hash to_io to_str to_ary to_int)
4
+ return nil if skip_methods.include?(args[0])
5
+ return args[0]
6
+ end
7
+ end
8
+
9
+ define_method(:சாற்று) { |random_function_name|
10
+ var_name = local_variables.find do |local_var|
11
+ local_var != :random_function_name && eval(local_var.to_s) == random_function_name
12
+ end
13
+ define_method(var_name) { |*args|
14
+ send(random_function_name, *args)
15
+ }
16
+ }
17
+
18
+ def வினை(*args, &block)
19
+ func_name = :"func_#{rand(1000000)}"
20
+
21
+ klass = Class.new { attr_accessor *args }
22
+ function_block = Proc.new { |*arg_values|
23
+ obj = klass.new
24
+ args.zip(arg_values).each {|arg, arg_value| obj.send(:"#{arg}=", arg_value) }
25
+ obj.instance_eval(&block)
26
+ }
27
+
28
+ define_method(func_name, &function_block)
29
+
30
+ func_name
31
+ end
32
+
33
+ def எனில்(val, &proc)
34
+ yield if val
35
+ end
36
+
37
+ def மெய்
38
+ true
39
+ end
40
+
41
+ def பொய்
42
+ false
43
+ end
44
+
45
+ def இல்லைஎனில்(val, &proc)
46
+ yield unless val
47
+ end
48
+
49
+ def நிறுத்து(val)
50
+ val
51
+ end
52
+
53
+ def மீண்டும்(&block)
54
+ loop do
55
+ result = yield
56
+ break if result
57
+ end
58
+ end
59
+
60
+ alias :அச்சு puts
@@ -0,0 +1,3 @@
1
+ module Uyirmei
2
+ VERSION = '0.0.1'
3
+ end
@@ -0,0 +1,14 @@
1
+ require 'test_helper'
2
+
3
+ class DefaultTest < Test::Unit::TestCase
4
+
5
+ def setup
6
+ end
7
+
8
+ def teardown
9
+ end
10
+
11
+ def test_the_truth
12
+ assert true
13
+ end
14
+ end
@@ -0,0 +1,9 @@
1
+ require 'test/unit'
2
+
3
+ # Add test libraries you want to use here, e.g. mocha
4
+
5
+ class Test::Unit::TestCase
6
+
7
+ # Add global extensions to the test case class here
8
+
9
+ end
@@ -0,0 +1,22 @@
1
+ # Ensure we require the local version and not one we might have installed already
2
+ require File.join([File.dirname(__FILE__),'lib','uyirmei','version.rb'])
3
+ spec = Gem::Specification.new do |s|
4
+ s.name = 'uyirmei'
5
+ s.version = Uyirmei::VERSION
6
+ s.author = 'RC'
7
+ s.email = 'rc.chandru@gmail.com'
8
+ s.homepage = 'https://rcdexta.github.io/agaram'
9
+ s.platform = Gem::Platform::RUBY
10
+ s.summary = 'Experimental programming language in Tamizh'
11
+ s.files = `git ls-files`.split("
12
+ ")
13
+ s.require_paths << 'lib'
14
+ s.rdoc_options << '--title' << 'uyirmei' << '--main' << 'README.rdoc' << '-ri'
15
+ s.bindir = 'bin'
16
+ s.executables << 'uyirmei'
17
+ s.add_development_dependency('rake')
18
+ s.add_development_dependency('rdoc')
19
+ s.add_development_dependency('pry-byebug')
20
+ s.add_development_dependency('aruba')
21
+ s.add_runtime_dependency('gli','2.16.0')
22
+ end
metadata ADDED
@@ -0,0 +1,139 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: uyirmei
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - RC
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-07-31 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rake
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rdoc
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: pry-byebug
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: aruba
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: gli
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '='
74
+ - !ruby/object:Gem::Version
75
+ version: 2.16.0
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '='
81
+ - !ruby/object:Gem::Version
82
+ version: 2.16.0
83
+ description:
84
+ email: rc.chandru@gmail.com
85
+ executables:
86
+ - uyirmei
87
+ extensions: []
88
+ extra_rdoc_files: []
89
+ files:
90
+ - ".gitignore"
91
+ - Gemfile
92
+ - Gemfile.lock
93
+ - LICENSE.md
94
+ - README.md
95
+ - Rakefile
96
+ - assets/odd_even.png
97
+ - assets/prime-sm.png
98
+ - bin/uyirmei
99
+ - examples/odd_even.um
100
+ - examples/prime.um
101
+ - features/step_definitions/uyirmei_steps.rb
102
+ - features/support/env.rb
103
+ - features/uyirmei.feature
104
+ - lib/uyirmei.rb
105
+ - lib/uyirmei/core.rb
106
+ - lib/uyirmei/version.rb
107
+ - test/default_test.rb
108
+ - test/test_helper.rb
109
+ - uyirmei.gemspec
110
+ homepage: https://rcdexta.github.io/agaram
111
+ licenses: []
112
+ metadata: {}
113
+ post_install_message:
114
+ rdoc_options:
115
+ - "--title"
116
+ - uyirmei
117
+ - "--main"
118
+ - README.rdoc
119
+ - "-ri"
120
+ require_paths:
121
+ - lib
122
+ - lib
123
+ required_ruby_version: !ruby/object:Gem::Requirement
124
+ requirements:
125
+ - - ">="
126
+ - !ruby/object:Gem::Version
127
+ version: '0'
128
+ required_rubygems_version: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - ">="
131
+ - !ruby/object:Gem::Version
132
+ version: '0'
133
+ requirements: []
134
+ rubyforge_project:
135
+ rubygems_version: 2.6.12
136
+ signing_key:
137
+ specification_version: 4
138
+ summary: Experimental programming language in Tamizh
139
+ test_files: []