schaefer 0.0.3 → 0.0.4

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.
Files changed (57) hide show
  1. data/.DS_Store +0 -0
  2. data/Examples/.DS_Store +0 -0
  3. data/Examples/{exampleAdd.sch → Arithmatic/exampleAdd.sch} +0 -0
  4. data/Examples/Arithmatic/exampleDivision.sch +1 -0
  5. data/Examples/{exampleMultipy.sch → Arithmatic/exampleMultipy.sch} +0 -0
  6. data/Examples/Arithmatic/exampleSubtraction.sch +1 -0
  7. data/Examples/Commenting/exampleComment.sch +12 -0
  8. data/Examples/FlowControl/exampleDo.sch +18 -0
  9. data/Examples/FlowControl/exampleGreater.sch +17 -0
  10. data/Examples/FlowControl/exampleIf.sch +18 -0
  11. data/Examples/FlowControl/exampleLesser.sch +13 -0
  12. data/Examples/Functions/exampleFunction.sch +18 -0
  13. data/Examples/Functions/exampleFunction2.sch +10 -0
  14. data/Examples/Input:Output/exampleDisplay.sch +6 -0
  15. data/Examples/Input:Output/exampleInput.sch +13 -0
  16. data/Examples/Input:Output/exampleWrite.sch +6 -0
  17. data/Examples/Lists/exampleAppend.sch +9 -0
  18. data/Examples/Lists/exampleConstruct.sch +27 -0
  19. data/Examples/Lists/exampleLength.sch +9 -0
  20. data/Examples/Lists/exampleList.sch +7 -0
  21. data/Examples/Lists/exampleListFirst.sch +10 -0
  22. data/Examples/Lists/exampleQuote.sch +7 -0
  23. data/Examples/Lists/exampleShift.sch +11 -0
  24. data/Examples/Lists/exampleUnshift.sch +18 -0
  25. data/Examples/Practical/each.sch +22 -0
  26. data/Examples/Practical/fib.sch +44 -0
  27. data/bin/.DS_Store +0 -0
  28. data/bin/{schaefer → schaefers} +0 -0
  29. data/lib/schaefer/Library/append.sch +6 -0
  30. data/lib/schaefer/Library/comment.sch +5 -0
  31. data/lib/schaefer/Library/construct.sch +13 -0
  32. data/lib/schaefer/Library/display.sch +1 -1
  33. data/lib/schaefer/Library/divisionOperator.sch +7 -0
  34. data/lib/schaefer/Library/isgreater.sch +3 -1
  35. data/lib/schaefer/Library/length.sch +7 -0
  36. data/lib/schaefer/Library/list.sch +8 -0
  37. data/lib/schaefer/Library/listFirst.sch +7 -0
  38. data/lib/schaefer/Library/quote.sch +6 -0
  39. data/lib/schaefer/Library/shift.sch +7 -0
  40. data/lib/schaefer/Library/subtractionOperator.sch +7 -0
  41. data/lib/schaefer/Library/tonum.sch +6 -0
  42. data/lib/schaefer/Library/tostr.sch +6 -0
  43. data/lib/schaefer/Library/unshift.sch +11 -0
  44. data/lib/schaefer/Library/write.sch +1 -1
  45. data/lib/schaefer/interpreter.rb +3 -2
  46. data/lib/schaefer/parser.rb +59 -4
  47. data/lib/schaefer/version.rb +1 -1
  48. metadata +43 -24
  49. data/Examples/exampleDisplay.sch +0 -1
  50. data/Examples/exampleDo.sch +0 -8
  51. data/Examples/exampleFunction.sch +0 -11
  52. data/Examples/exampleFunction2.sch +0 -4
  53. data/Examples/exampleGets.sch +0 -7
  54. data/Examples/exampleGreater.sch +0 -7
  55. data/Examples/exampleIf.sch +0 -12
  56. data/Examples/exampleLesser.sch +0 -6
  57. data/Examples/exampleWrite.sch +0 -1
data/.DS_Store CHANGED
Binary file
data/Examples/.DS_Store CHANGED
Binary file
@@ -0,0 +1 @@
1
+ (write (/ (/ 100 2) 2))
@@ -0,0 +1 @@
1
+ (write (- (- 100 (- 100 50) 25) 20))
@@ -0,0 +1,12 @@
1
+ Commenting can be acheaved by simply typing outside of parenthesees. There
2
+ are a few things to be careful of though. Commas and some other symbols are
3
+ not yet recognized in the parser so they return wierd values. This will be
4
+ fixed in the next release. Also be careful not to include any parenthasees
5
+ because otherwise they will be interpreted as commands!
6
+
7
+
8
+ (define test
9
+ (function ()
10
+ (## When inside of parenthasees just use the double hash)
11
+ (write "hello")))
12
+ (test)
@@ -0,0 +1,18 @@
1
+ Do is a function that steps through a list of commands. In some functions such as if as seen below
2
+ a number of commands must be executed within a single set of parenthasees. This task is accomplished
3
+ with the do function.
4
+ _____________________________________________________________________________________________________
5
+
6
+
7
+ (define one 1)
8
+ (define won 1)
9
+
10
+ (if (equal? one won)
11
+ (do
12
+ (display "1 and 1 are equal")
13
+ (write " and thats a fact"))
14
+ (write "1 and 1 are not equal!"))
15
+
16
+
17
+ -------------------------------------------------------------------------------------
18
+ This example will return "1 and 1 are equal and thats a fact" followed by a new line.
@@ -0,0 +1,17 @@
1
+ The isGreater? function allows you to test weather one number is greater than the other.
2
+ The greater check takes two arguments and compares the first to the seccond.
3
+ ----------------------------------------------------------------------------------------
4
+
5
+
6
+ (define one 1)
7
+ (define two 2)
8
+
9
+ (if(isGreater? one two)
10
+ (write "1 > 2")
11
+ (write "1 < 2"))
12
+
13
+
14
+
15
+ -----------------------------------------------------------------------------------------------
16
+ In this example the correct return is "1 < 2". Because 1 is being compared to 2 isGreater? will
17
+ return false.
@@ -0,0 +1,18 @@
1
+ The if function takes three arguments. The first is the comparison which will either return
2
+ true or false. The seccond is the true case which will be executed if the result of the
3
+ comparison is true. And the last is the false case which will be executed if the result
4
+ of the comparisson is false.
5
+ --------------------------------------------------------------------------------------------
6
+
7
+
8
+ (define one 1)
9
+ (define won 1)
10
+ (define two 2)
11
+
12
+ (if (= one won)
13
+ (write "1 = 1")
14
+ (write "1 != 1"))
15
+
16
+ (if (equal? one two)
17
+ (write "1 = 2")
18
+ (write "1 != 2"))
@@ -0,0 +1,13 @@
1
+ The isLesser? is a comparitive function that takes two arguments.
2
+ TIf the first is lesser than the seccond the function will return
3
+ true and if the first is greater than the seccond the function
4
+ will return false
5
+ ------------------------------------------------------------------
6
+
7
+
8
+ (define one 1)
9
+ (define two 2)
10
+
11
+ (if(isLesser? one two)
12
+ (write "1 < 2")
13
+ (write "1 > 2"))
@@ -0,0 +1,18 @@
1
+ The function function has many uses. When passed no variables it can be used
2
+ to make your definition executable and allowing loops. In this example you
3
+ are prompted to enter a password until you answer correctly. This demonstrates
4
+ using empty functions to generate loops and executable definitions.
5
+ -------------------------------------------------------------------------------
6
+
7
+
8
+ (define program
9
+ (function ()
10
+ (display "Enter password (Hint its password): ")
11
+ (define response (input))
12
+ (if (= response "password")
13
+ (write "Great Job!")
14
+ (do
15
+ (write "Im sorry. Thats incorrect!")
16
+ (program)))))
17
+
18
+ (program)
@@ -0,0 +1,10 @@
1
+ This example demonstrates how functions can be used by passing them arguments.
2
+ Using functions in this mannor allows you to create new functions much like
3
+ some that define this language!
4
+ ------------------------------------------------------------------------------
5
+
6
+
7
+ (define double
8
+ (function (x) (+ x x)))
9
+
10
+ (write (double 5))
@@ -0,0 +1,6 @@
1
+ The display command takes one argument. The function then evaluates that argument and displays
2
+ it to the screen without a trailing newline.
3
+ ----------------------------------------------------------------------------------------------
4
+
5
+
6
+ (display "hello")
@@ -0,0 +1,13 @@
1
+ The input command takes no arguments. In allows for user input up until a newline
2
+ is detected. The function then returns a string of the input excluding the newline
3
+ character.
4
+ ----------------------------------------------------------------------------------
5
+
6
+
7
+ (display "Enter password (Hint: its password): ")
8
+ (define result (input))
9
+
10
+ (if(= result "password")
11
+ (write "Excellent!")
12
+ (write "Wrong!"))
13
+
@@ -0,0 +1,6 @@
1
+ The write command is nearly identical to the display command. It takes one argument then evaluates
2
+ that argument and displays it to the screen with a trailing newline.
3
+ --------------------------------------------------------------------------------------------------
4
+
5
+
6
+ (write "hello")
@@ -0,0 +1,9 @@
1
+ The append command takes an unlimited ammount of arguments. It works by constructing
2
+ a single list given multiple in the same order that they are specified.
3
+ ------------------------------------------------------------------------------------
4
+
5
+
6
+ (define l1 (quote (1 2 3 4 5)))
7
+ (define l2 (quote (6 7 8 9 0)))
8
+
9
+ (write (append l1 l2))
@@ -0,0 +1,27 @@
1
+ Construct takes two arguments. By performing a construct argument 1 is placed before argument 3
2
+ and the result is not flattened. This has the effect of creating multi-dimensional arrays. Notice
3
+ that the length reflects the number of elements with a sub-list contributing one.
4
+ -------------------------------------------------------------------------------------------------
5
+
6
+
7
+ (define list1 (list 1 2 3 4 5))
8
+ (define list2 (list 6 7 8 9 0))
9
+
10
+ (display "List1: ")
11
+ (write list1)
12
+
13
+ (display "List2: ")
14
+ (write list2)
15
+
16
+ (define ap (append list1 list2))
17
+ (define con (construct list1 list2))
18
+
19
+ (display "Appended List1-List2: ")
20
+ (display ap)
21
+ (display " -Length: ")
22
+ (write (length ap))
23
+
24
+ (display "Constructed List1-List2: ")
25
+ (display con)
26
+ (display " -Length: ")
27
+ (write (length con))
@@ -0,0 +1,9 @@
1
+ The length function takes one argument. The argument is then evaluated
2
+ and the length of the list is returned.
3
+ ----------------------------------------------------------------------
4
+
5
+
6
+ (define l1 (list 0 1 2 3 4 5 6 7))
7
+ (define l2 (list 8 9 10))
8
+
9
+ (write (length (append l1 l2)))
@@ -0,0 +1,7 @@
1
+ A list is a data type similar to an array in that it is a grouping of values
2
+ but different in that they are not tied to any keys. When lists are created
3
+ with the list function each element is evaluated before it is stored.
4
+ ----------------------------------------------------------------------------
5
+
6
+
7
+ (write (list 1 2 3 4 5))
@@ -0,0 +1,10 @@
1
+ The listFirst command takes one list as an argument. It then returns the first element
2
+ of the provided list.
3
+ --------------------------------------------------------------------------------------
4
+
5
+
6
+ (define l1 (quote (1 2 3 4 5)))
7
+
8
+ (write l1)
9
+ (display "First: ")
10
+ (write (listFirst l1))
@@ -0,0 +1,7 @@
1
+ By using quote you can create lists without evaluating each element. When you create a list
2
+ using the list keyword each element is evaluated and symbols are interpreted as variables.
3
+ By quoting the contents of a list are not evaluated and symbols are left unevaluated.
4
+ --------------------------------------------------------------------------------------------
5
+
6
+
7
+ (write (quote (1 2 3 4 5 bob)))
@@ -0,0 +1,11 @@
1
+ The shift function takes one list as the argument. The function removes the first element from
2
+ the list and returns the list again. A combination of listFirst and shift can be used to get
3
+ a different values from a list.
4
+ -----------------------------------------------------------------------------------------------
5
+
6
+
7
+ (define l1 (list 1 2 3 4 5))
8
+ (display "List: ")
9
+ (write l1)
10
+ (display "List Post-Shift: ")
11
+ (write (shift l1))
@@ -0,0 +1,18 @@
1
+ The unshift function takes an unlimited number of arguments. The unshift function
2
+ takes an array provided in argument 1 and evaluates the subsequent arguments. It
3
+ then adds the result before the first list in the order they were provided and
4
+ then flattens the list. Eg. Argument 1 is the list 1 2 3. Argument 2 is the list
5
+ 3 4 5. Argument 3 is 5 6 7. The list resulting from unshifting under these conditions
6
+ would be 3 4 5 5 6 7 1 2 3.
7
+ -------------------------------------------------------------------------------------
8
+
9
+
10
+ (define list1 (list -4 -3 -2 -1 0))
11
+ (define list2 (list 1 2 3 4 5))
12
+ (define list3 (list 6 7 8 9 10))
13
+
14
+ (display "Append: ")
15
+ (write (append list1 list2 list3))
16
+
17
+ (display "Unshift: ")
18
+ (write (unshift list3 list1 list2))
@@ -0,0 +1,22 @@
1
+ THe each example demonstrates how a typical array-each would be written in
2
+ SchaeferScript. Rather that just writing the element that you are currently
3
+ at you could do any task.
4
+ ---------------------------------------------------------------------------
5
+
6
+
7
+ (define i 0)
8
+ (define offset 0)
9
+ (define li (list 1 2 3 4 5 6))
10
+
11
+ (define each
12
+ (function (lis)
13
+ (if (= (+ (length lis) offset) i)
14
+ (display "")
15
+ (do
16
+ (write (listFirst lis))
17
+ (define lis (shift lis))
18
+ (define i (+ i 1))
19
+ (define offset (+ offset 1))
20
+ (each lis)))))
21
+
22
+ (each li)
@@ -0,0 +1,44 @@
1
+ (define i 0)
2
+ (define p 0)
3
+ (define c 1)
4
+
5
+ (define test
6
+ (function (x)
7
+ (if(= i x)
8
+ (do
9
+ (define i 0)
10
+ (define p 0)
11
+ (define c 1)
12
+ )
13
+ (do
14
+ (define np c)
15
+ (define nc (+ p c))
16
+ (define p np)
17
+ (define c nc)
18
+ (write c)
19
+ (define i (+ i 1))
20
+ (test x)
21
+ )
22
+ )
23
+ )
24
+ )
25
+
26
+ (define run
27
+ (function ()
28
+ (do
29
+ (write "How many Fibbonocci numbers would you like me to calculate?")
30
+ (display ">> ")
31
+ (define num (input))
32
+ (if (= num "exit")
33
+ (write "")
34
+ (do
35
+ (define num (->num num))
36
+ (test num)
37
+ (run)
38
+ )
39
+ )
40
+ )
41
+ )
42
+ )
43
+
44
+ (run)
data/bin/.DS_Store CHANGED
File without changes
File without changes
@@ -0,0 +1,6 @@
1
+ (define append
2
+ (native_function "
3
+ Proc.new() do |arguments, interpreter|
4
+ arguments.map {|x| interpreter.evaluate(x) }.flatten
5
+ end
6
+ "))
@@ -0,0 +1,5 @@
1
+ (define ##
2
+ (native_function "
3
+ Proc.new do |arguments, interpreter|
4
+ end
5
+ "))
@@ -0,0 +1,13 @@
1
+ (define construct
2
+ (native_function "
3
+ Proc.new() do |arguments, interpreter|
4
+ arg_1 = interpreter.evaluate(arguments[0])
5
+ arg_2 = interpreter.evaluate(arguments[1]).dup
6
+
7
+ if arg_2.is_a? Array
8
+ arg_2.unshift arg_1
9
+ else
10
+ [arg_1, arg_2]
11
+ end
12
+ end
13
+ "))
@@ -2,6 +2,6 @@
2
2
  (native_function "
3
3
  Proc.new do |arguments, interpreter|
4
4
  output = interpreter.evaluate(arguments[0])
5
- print output
5
+ print interpreter.parser.toToken(output)
6
6
  end
7
7
  "))
@@ -0,0 +1,7 @@
1
+ (define /
2
+ (native_function "
3
+ Proc.new do |arguments, interpreter|
4
+ tmp = arguments.map {|x| interpreter.evaluate(x)}
5
+ tmp.inject {|sum, n| sum / n}
6
+ end
7
+ "))
@@ -1,4 +1,4 @@
1
- (define isgreater?
1
+ (define isGreater?
2
2
  (native_function "
3
3
  Proc.new do |arguments, interpreter|
4
4
  arguments.slice(1, arguments.length).all? do |x|
@@ -6,3 +6,5 @@
6
6
  end
7
7
  end
8
8
  "))
9
+
10
+ (define > isGreater?)
@@ -0,0 +1,7 @@
1
+ (define length
2
+ (native_function "
3
+ Proc.new do |argument, interpreter|
4
+ list = interpreter.evaluate(argument[0])
5
+ list.length
6
+ end
7
+ "))
@@ -0,0 +1,8 @@
1
+ (define list
2
+ (native_function "
3
+ Proc.new do |arguments, interpreter|
4
+ arguments.map do |x|
5
+ interpreter.evaluate(x)
6
+ end
7
+ end
8
+ "))
@@ -0,0 +1,7 @@
1
+ (define listFirst
2
+ (native_function "
3
+ Proc.new do |argument, interpreter|
4
+ list = interpreter.evaluate(argument[0])
5
+ list[0]
6
+ end
7
+ "))
@@ -0,0 +1,6 @@
1
+ (define quote
2
+ (native_function "
3
+ Proc.new do |arguments, interpreter|
4
+ arguments[0]
5
+ end
6
+ "))
@@ -0,0 +1,7 @@
1
+ (define shift
2
+ (native_function "
3
+ Proc.new do |argument, interpreter|
4
+ list = interpreter.evaluate(argument[0])
5
+ list.slice(1, list.length)
6
+ end
7
+ "))
@@ -0,0 +1,7 @@
1
+ (define -
2
+ (native_function "
3
+ Proc.new do |arguments, interpreter|
4
+ tmp = arguments.map {|x| interpreter.evaluate(x)}
5
+ tmp.inject {|sum, n| sum - n}
6
+ end
7
+ "))
@@ -0,0 +1,6 @@
1
+ (define ->num
2
+ (native_function "
3
+ Proc.new do |arguments, interpreter|
4
+ interpreter.evaluate(arguments[0]).to_i
5
+ end
6
+ "))
@@ -0,0 +1,6 @@
1
+ (define ->str
2
+ (native_function "
3
+ Proc.new do |arguments, interpreter|
4
+ interpreter.evaluate(arguments[0]).to_s
5
+ end
6
+ "))
@@ -0,0 +1,11 @@
1
+ (define unshift
2
+ (native_function "
3
+ Proc.new do |arguments, interpreter|
4
+ arg1 = interpreter.evaluate(arguments[0])
5
+ newargs = arguments.slice(1, arguments.length)
6
+ newargs.reverse_each do |argument|
7
+ arg1.unshift(interpreter.evaluate(argument))
8
+ end
9
+ arg1.flatten
10
+ end
11
+ "))
@@ -2,6 +2,6 @@
2
2
  (native_function "
3
3
  Proc.new do |arguments, interpreter|
4
4
  output = interpreter.evaluate(arguments[0])
5
- puts output
5
+ puts interpreter.parser.toToken(output)
6
6
  end
7
7
  "))
@@ -1,14 +1,15 @@
1
1
  module Schaefer
2
2
  class Interpreter
3
- attr_accessor :base_environment, :current_environment
3
+ attr_accessor :base_environment, :current_environment, :parser
4
4
 
5
5
  def initialize()
6
6
  @base_environment = @current_environment = Schaefer::Environment.new
7
+ @parser = Parser.new
7
8
  loadLibrary
8
9
  end
9
10
 
10
11
  def run(program)
11
- expressions = Parser.new.parse(program)
12
+ expressions = @parser.parse(program)
12
13
  result = nil
13
14
  expressions.each do |expression|
14
15
  result = evaluate(expression)
@@ -12,10 +12,21 @@ class Parser
12
12
  end
13
13
 
14
14
  def tokenize(string) #method used split program into tokens by adding spaces arround '('s and calling string.split(' ')
15
- string = string.gsub("(", " ( ")
16
- string = string.gsub(")", " ) ")
17
- tokens = string.split(" ")
18
- return tokens
15
+ numOpen = string.count("(")
16
+ numClose = string.count(")")
17
+ numMissing = 0
18
+ if numOpen > numClose
19
+ numMissing = numOpen - numClose
20
+ raise RuntimeError, "#{numMissing} missing close parenthasees"
21
+ elsif numClose > numOpen
22
+ numMissing = numClose - numOpen
23
+ raise RuntimeError, "#{numMissing} extra close parenthasees"
24
+ elsif numClose == numOpen
25
+ string = string.gsub("(", " ( ")
26
+ string = string.gsub(")", " ) ")
27
+ tokens = string.split(" ")
28
+ return tokens
29
+ end
19
30
  end
20
31
 
21
32
  def replaceSLiterals(tokens, literals) #method used to restore string literals in our tokens array now that we dont have to worry about special cases
@@ -83,5 +94,49 @@ class Parser
83
94
  structure = formStructure(tokens)[1]
84
95
  return structure
85
96
  end
97
+
98
+ def convertLiterals(data)
99
+ return recursiveMap(data) do |x|
100
+ case x
101
+ when nil then []
102
+ when true then :"#t"
103
+ when false then :"#f"
104
+ else x
105
+ end
106
+ end
107
+ end
108
+
109
+ # Convert a set of nested arrays back into an S-Expression
110
+ def toToken(data)
111
+ data = convertLiterals(data)
112
+ if(data.is_a?(Array))
113
+ mapped = data.map do |item|
114
+ if(item.is_a?(Array))
115
+ toToken(item)
116
+ else
117
+ item.to_s
118
+ end
119
+ end
120
+ "(" + mapped.join(" ") + ")"
121
+ else
122
+ data.to_s
123
+ end
124
+ end
125
+
126
+ private
127
+
128
+ def recursiveMap(data, &block)
129
+ if(data.is_a?(Array))
130
+ return data.map do |x|
131
+ if(x.is_a?(Array))
132
+ recursiveMap(x, &block)
133
+ else
134
+ block.call(x)
135
+ end
136
+ end
137
+ else
138
+ block.call(data)
139
+ end
140
+ end
86
141
  end
87
142
 
@@ -1,3 +1,3 @@
1
1
  module Schaefer
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
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: 25
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 3
10
- version: 0.0.3
9
+ - 4
10
+ version: 0.0.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Tommy Schaefer
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-05-27 00:00:00 Z
18
+ date: 2012-05-29 00:00:00 Z
19
19
  dependencies: []
20
20
 
21
21
  description: Schaefer is a small programming language deigned to show how to build a programming language. Running the command 'schaefer' begins console based execution of code and passing a file name will execute the file. SchaeferScript is a scheme-style language where the core functions are written in ruby and other functions written in the language itself. You can access the source for SchaeferScript at https://github.com/tommyschaefer/SchaeferScript.
@@ -23,7 +23,7 @@ email:
23
23
  - me@tommyschaefer.net
24
24
  executables:
25
25
  - .DS_Store
26
- - schaefer
26
+ - schaefers
27
27
  extensions: []
28
28
 
29
29
  extra_rdoc_files: []
@@ -33,35 +33,47 @@ files:
33
33
  - .gitignore
34
34
  - .gitignore~
35
35
  - Examples/.DS_Store
36
- - Examples/exampleAdd.sch
37
- - Examples/exampleAdd.sch~
38
- - Examples/exampleDisplay.sch
39
- - Examples/exampleDisplay.sch~
40
- - Examples/exampleDo.sch
41
- - Examples/exampleDo.sch~
42
- - Examples/exampleFunction.sch
43
- - Examples/exampleFunction2.sch
44
- - Examples/exampleGets.sch
45
- - Examples/exampleGreater.sch
46
- - Examples/exampleIf.sch
47
- - Examples/exampleLesser.sch
48
- - Examples/exampleMultipy.sch
49
- - Examples/exampleWrite.sch
50
- - Examples/exampleWrite.sch~
36
+ - Examples/Arithmatic/exampleAdd.sch
37
+ - Examples/Arithmatic/exampleDivision.sch
38
+ - Examples/Arithmatic/exampleMultipy.sch
39
+ - Examples/Arithmatic/exampleSubtraction.sch
40
+ - Examples/Commenting/exampleComment.sch
41
+ - Examples/FlowControl/exampleDo.sch
42
+ - Examples/FlowControl/exampleGreater.sch
43
+ - Examples/FlowControl/exampleIf.sch
44
+ - Examples/FlowControl/exampleLesser.sch
45
+ - Examples/Functions/exampleFunction.sch
46
+ - Examples/Functions/exampleFunction2.sch
47
+ - Examples/Input:Output/exampleDisplay.sch
48
+ - Examples/Input:Output/exampleInput.sch
49
+ - Examples/Input:Output/exampleWrite.sch
50
+ - Examples/Lists/exampleAppend.sch
51
+ - Examples/Lists/exampleConstruct.sch
52
+ - Examples/Lists/exampleLength.sch
53
+ - Examples/Lists/exampleList.sch
54
+ - Examples/Lists/exampleListFirst.sch
55
+ - Examples/Lists/exampleQuote.sch
56
+ - Examples/Lists/exampleShift.sch
57
+ - Examples/Lists/exampleUnshift.sch
58
+ - Examples/Practical/each.sch
59
+ - Examples/Practical/fib.sch
51
60
  - Gemfile
52
61
  - LICENSE
53
62
  - README.md
54
63
  - Rakefile
55
64
  - bin/.DS_Store
56
- - bin/schaefer
65
+ - bin/schaefers
57
66
  - lib/.DS_Store
58
67
  - lib/schaefer.rb
59
68
  - lib/schaefer/.DS_Store
60
69
  - lib/schaefer/.environment.rb.swp
61
70
  - lib/schaefer/Library/.DS_Store
62
71
  - lib/schaefer/Library/additionOperator.sch
72
+ - lib/schaefer/Library/append.sch
73
+ - lib/schaefer/Library/comment.sch
74
+ - lib/schaefer/Library/construct.sch
63
75
  - lib/schaefer/Library/display.sch
64
- - lib/schaefer/Library/display.sch~
76
+ - lib/schaefer/Library/divisionOperator.sch
65
77
  - lib/schaefer/Library/do.sch
66
78
  - lib/schaefer/Library/do.sch~
67
79
  - lib/schaefer/Library/equalTo.sch
@@ -72,13 +84,20 @@ files:
72
84
  - lib/schaefer/Library/input.sch
73
85
  - lib/schaefer/Library/isgreater.sch
74
86
  - lib/schaefer/Library/islesser.sch
87
+ - lib/schaefer/Library/length.sch
88
+ - lib/schaefer/Library/list.sch
89
+ - lib/schaefer/Library/listFirst.sch
75
90
  - lib/schaefer/Library/multiplicationOperator.sch
91
+ - lib/schaefer/Library/quote.sch
92
+ - lib/schaefer/Library/shift.sch
93
+ - lib/schaefer/Library/subtractionOperator.sch
94
+ - lib/schaefer/Library/tonum.sch
95
+ - lib/schaefer/Library/tostr.sch
96
+ - lib/schaefer/Library/unshift.sch
76
97
  - lib/schaefer/Library/write.sch
77
- - lib/schaefer/Library/write.sch~
78
98
  - lib/schaefer/environment.rb
79
99
  - lib/schaefer/interpreter.rb
80
100
  - lib/schaefer/parser.rb
81
- - lib/schaefer/parser.rb~
82
101
  - lib/schaefer/version.rb
83
102
  - schaefer.gemspec
84
103
  homepage: https://github.com/tommyschaefer/SchaeferScript
@@ -1 +0,0 @@
1
- (display "hello")
@@ -1,8 +0,0 @@
1
- (define one 1)
2
- (define won 1)
3
-
4
- (if (equal? one won)
5
- (do
6
- (display "1 and 1 are equal")
7
- (write " and thats a fact"))
8
- (write "1 and 1 are not equal!")
@@ -1,11 +0,0 @@
1
- (define program
2
- (function ()
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,4 +0,0 @@
1
- (define double
2
- (function (x) (+ x x)))
3
-
4
- (write (double 5))
@@ -1,7 +0,0 @@
1
- (display "Enter password (Hint: its password): ")
2
- (define result (input))
3
-
4
- (if(= result "password")
5
- (write "Excellent!")
6
- (write "Wrong!")
7
-
@@ -1,7 +0,0 @@
1
- (define one 1)
2
- (define two 2)
3
-
4
- (if(isgreater? one two)
5
- (write "1 > 2")
6
- (write "1 < 2"))
7
-
@@ -1,12 +0,0 @@
1
- (define one 1)
2
- (define won 1)
3
- (define two 2)
4
-
5
- (if (= one won)
6
- (write "1 = 1")
7
- (write "1 != 1"))
8
-
9
- (if (equal? one two)
10
- (write "1 = 2")
11
- (write "1 != 2"))
12
-
@@ -1,6 +0,0 @@
1
- (define one 1)
2
- (define two 2)
3
-
4
- (if(isLesser? one two)
5
- (write "1 < 2")
6
- (write "1 > 2"))
@@ -1 +0,0 @@
1
- (write "hello")