schaefer 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/.DS_Store CHANGED
Binary file
data/.gitignore CHANGED
@@ -15,3 +15,8 @@ spec/reports
15
15
  test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
+ *.sch~
19
+ *.rb~
20
+ .DS_STORE
21
+ *.environment.rb.swp
22
+ *.gitignore~
@@ -0,0 +1,7 @@
1
+ (define one 1)
2
+ (define two 2)
3
+
4
+ (if(isgreater? one two)
5
+ (write "1 > 2")
6
+ (write "1 < 2"))
7
+
@@ -0,0 +1,6 @@
1
+ (define one 1)
2
+ (define two 2)
3
+
4
+ (if(isLesser? one two)
5
+ (write "1 < 2")
6
+ (write "1 > 2"))
@@ -0,0 +1,3 @@
1
+ (display "2*4 = ")
2
+ (write (* 2 4))
3
+
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Schaefer
2
2
 
3
- TODO: Write a gem description
3
+ SchaeferScript is a small programming language that resembles lisp and scheme. SchaeferScript was designed to demonstrate how a programming language can be built in ruby. This language is primarily instructionall, but is very flexible and can eventually be written in itself.
4
4
 
5
5
  ## Installation
6
6
 
@@ -18,12 +18,16 @@ Or install it yourself as:
18
18
 
19
19
  ## Usage
20
20
 
21
- TODO: Write usage instructions here
21
+ By running the command:
22
+
23
+ schaefer
22
24
 
23
- ## Contributing
25
+ you enter into the command line interface where programs can be executed line by line. By passing a file to the 'schaefer' command:
24
26
 
25
- 1. Fork it
26
- 2. Create your feature branch (`git checkout -b my-new-feature`)
27
- 3. Commit your changes (`git commit -am 'Added some feature'`)
28
- 4. Push to the branch (`git push origin my-new-feature`)
29
- 5. Create new Pull Request
27
+ schaefer <file>
28
+
29
+ the file is executed. To run in verbose mode call:
30
+
31
+ schaefer -v <file>
32
+
33
+ Running in verbose mode will output non-displayed returns.
File without changes
File without changes
Binary file
Binary file
@@ -0,0 +1,8 @@
1
+ (define isgreater?
2
+ (native_function "
3
+ Proc.new do |arguments, interpreter|
4
+ arguments.slice(1, arguments.length).all? do |x|
5
+ interpreter.evaluate(arguments[0]) > interpreter.evaluate(x)
6
+ end
7
+ end
8
+ "))
@@ -0,0 +1,10 @@
1
+ (define isLesser?
2
+ (native_function "
3
+ Proc.new() do |arguments, interpreter|
4
+ arguments.slice(1, arguments.length).all? do |x|
5
+ interpreter.evaluate(arguments[0]) < interpreter.evaluate(x)
6
+ end
7
+ end
8
+ "))
9
+
10
+ (define < isLesser?)
@@ -0,0 +1,7 @@
1
+ (define *
2
+ (native_function "
3
+ Proc.new() do |arguments, interpreter|
4
+ tmp = arguments.map {|item| interpreter.evaluate(item)}
5
+ tmp.inject {|sum, n| sum * n}
6
+ end
7
+ "))
@@ -1,3 +1,3 @@
1
1
  module Schaefer
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: schaefer
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 2
10
- version: 0.0.2
9
+ - 3
10
+ version: 0.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Tommy Schaefer
@@ -31,6 +31,7 @@ extra_rdoc_files: []
31
31
  files:
32
32
  - .DS_Store
33
33
  - .gitignore
34
+ - .gitignore~
34
35
  - Examples/.DS_Store
35
36
  - Examples/exampleAdd.sch
36
37
  - Examples/exampleAdd.sch~
@@ -39,11 +40,12 @@ files:
39
40
  - Examples/exampleDo.sch
40
41
  - Examples/exampleDo.sch~
41
42
  - Examples/exampleFunction.sch
42
- - Examples/exampleFunction.sch~
43
43
  - Examples/exampleFunction2.sch
44
44
  - Examples/exampleGets.sch
45
+ - Examples/exampleGreater.sch
45
46
  - Examples/exampleIf.sch
46
- - Examples/exampleIf.sch~
47
+ - Examples/exampleLesser.sch
48
+ - Examples/exampleMultipy.sch
47
49
  - Examples/exampleWrite.sch
48
50
  - Examples/exampleWrite.sch~
49
51
  - Gemfile
@@ -68,6 +70,9 @@ files:
68
70
  - lib/schaefer/Library/if.sch
69
71
  - lib/schaefer/Library/if.sch~
70
72
  - lib/schaefer/Library/input.sch
73
+ - lib/schaefer/Library/isgreater.sch
74
+ - lib/schaefer/Library/islesser.sch
75
+ - lib/schaefer/Library/multiplicationOperator.sch
71
76
  - lib/schaefer/Library/write.sch
72
77
  - lib/schaefer/Library/write.sch~
73
78
  - lib/schaefer/environment.rb
@@ -1,11 +0,0 @@
1
- (define program
2
- (lambda ()
3
- (display "Enter password (Hint its password): ")
4
- (define response (input))
5
- (if (= response "password")
6
- (write "Great Job!")
7
- (do
8
- (write "Im sorry. Thats incorrect!")
9
- (program)))))
10
-
11
- (program)
@@ -1,13 +0,0 @@
1
- (define one 1)
2
- (define won 1)
3
- (define two 2)
4
- (define too 2)
5
-
6
- (if (= one won)
7
- (begin(write "1 = 1")(write "Woohoo!"))
8
- (write "1 != 1"))
9
-
10
- (if (equal? one two)
11
- (write "1 = 2")
12
- (write "1 != 2"))
13
-