cuby 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +5 -6
- data/VERSION +1 -1
- data/bin/icb +0 -0
- data/cbrun +12 -0
- data/cuby.gemspec +3 -2
- data/examples/example4.cb +1 -2
- data/lib/cuby/vm.rb +1 -1
- metadata +3 -2
data/README.md
CHANGED
@@ -14,32 +14,31 @@ A tiny C-like language built on top of Ruby, in less than 20 lines of code.
|
|
14
14
|
|
15
15
|
### Interactive Shell
|
16
16
|
|
17
|
-
Cuby comes with an interactive shell called `icb` (just like Ruby's `irb`) which you
|
17
|
+
Cuby comes with an interactive shell called `icb` (just like Ruby's `irb`) which you can run from the command line.
|
18
18
|
|
19
19
|
The shell is currently considered to be in an Alpha state, as it doesn't fully work with all the quirks of Cuby.
|
20
20
|
|
21
21
|
## Examples
|
22
22
|
|
23
|
-
Basic,
|
23
|
+
Basic, example1.cb:
|
24
24
|
|
25
25
|
// This is an example of the Cuby Language
|
26
26
|
main {
|
27
27
|
printf "Hello world\n"
|
28
28
|
}
|
29
29
|
|
30
|
-
Advanced(ish),
|
30
|
+
Advanced(ish), example4.cb:
|
31
31
|
|
32
32
|
// This is another example of the Cuby Language
|
33
33
|
include "cuby/stdio"
|
34
|
-
plea_for_merci_to {
|
35
|
-
|name|
|
34
|
+
plea_for_merci_to name {
|
36
35
|
shout "Please don't kill me " + name + "!"
|
37
36
|
}
|
38
37
|
main {
|
39
38
|
plea_for_merci_to "Jon"
|
40
39
|
}
|
41
40
|
|
42
|
-
|
41
|
+
cuby/stdio.rb:
|
43
42
|
|
44
43
|
def shout argument
|
45
44
|
puts argument.upcase
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.5
|
data/bin/icb
CHANGED
File without changes
|
data/cbrun
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# This file duplicates the functionality of the default cuby
|
3
|
+
# executable, only no gem installation is required for load
|
4
|
+
# paths to work.
|
5
|
+
|
6
|
+
$LOAD_PATH << File.dirname(__FILE__.gsub(/^.\/(.*)$/, "#{ENV["PWD"]}/\\1")) + "/lib"
|
7
|
+
require "rubygems"
|
8
|
+
require "cuby"
|
9
|
+
|
10
|
+
# Create and run the application
|
11
|
+
app = Cuby.new(ARGV, STDIN)
|
12
|
+
app.run
|
data/cuby.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{cuby}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.5"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Jon Vlachoyiannis", "Jim Myhrberg"]
|
12
|
-
s.date = %q{2009-10-
|
12
|
+
s.date = %q{2009-10-20}
|
13
13
|
s.description = %q{A tiny C-like language built on top of Ruby, in less than 20 lines of code.}
|
14
14
|
s.email = %q{jon@emotionull.com}
|
15
15
|
s.executables = ["cuby", "icb"]
|
@@ -25,6 +25,7 @@ Gem::Specification.new do |s|
|
|
25
25
|
"VERSION",
|
26
26
|
"bin/cuby",
|
27
27
|
"bin/icb",
|
28
|
+
"cbrun",
|
28
29
|
"cuby.gemspec",
|
29
30
|
"examples/example1.cb",
|
30
31
|
"examples/example2.cb",
|
data/examples/example4.cb
CHANGED
data/lib/cuby/vm.rb
CHANGED
@@ -16,7 +16,7 @@ def method_missing(meth, *args, &block)
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def preformat_data(data)
|
19
|
-
data.gsub(/^\s*\/\//,'#')
|
19
|
+
data.gsub(/^\s*\/\//,'#').gsub(/^(\s*)([a-zA-Z_]{1}[a-zA-Z0-9_]*)\s+(.+?)\s*\{/, "\\1\\2 { |\\3|")
|
20
20
|
end
|
21
21
|
|
22
22
|
#FIXME Interactive mode does not work with loop defined
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cuby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jon Vlachoyiannis
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2009-10-
|
13
|
+
date: 2009-10-20 00:00:00 +03:00
|
14
14
|
default_executable:
|
15
15
|
dependencies: []
|
16
16
|
|
@@ -32,6 +32,7 @@ files:
|
|
32
32
|
- VERSION
|
33
33
|
- bin/cuby
|
34
34
|
- bin/icb
|
35
|
+
- cbrun
|
35
36
|
- cuby.gemspec
|
36
37
|
- examples/example1.cb
|
37
38
|
- examples/example2.cb
|