diff --git a/.rdoc_options b/.rdoc_options index d19a5bf..f05fd82 100644 --- a/.rdoc_options +++ b/.rdoc_options @@ -4,7 +4,7 @@ static_path: [] rdoc_include: - . charset: UTF-8 -exclude: !ruby/regexp /(?-mix:doc)|(?-mix:sire.rb)|(?-mix:.*\.4th)|(?-mix:.*\.odt)|(?-mix:.*txt)|(?-mix:.*bat)|(?-mix:.*dll)|(?-mix:.*exe)/ +exclude: !ruby/regexp /(?-mix:doc)|(?-mix:sire.rb)|(?-mix:.*\.4th)|(?-mix:.*\.odt)|(?-mix:.*bat)/ hyperlink_all: false line_numbers: false main_page: diff --git a/lib/fOOrth/compiler/parser.rb b/lib/fOOrth/compiler/parser.rb index 4c35118..a0bb4bd 100644 --- a/lib/fOOrth/compiler/parser.rb +++ b/lib/fOOrth/compiler/parser.rb @@ -1,5 +1,7 @@ # coding: utf-8 +require_relative 'token' + #* parser.rb - Parse source code from a code source. module XfOOrth diff --git a/lib/fOOrth/compiler/token.rb b/lib/fOOrth/compiler/token.rb new file mode 100644 index 0000000..11d703f --- /dev/null +++ b/lib/fOOrth/compiler/token.rb @@ -0,0 +1,21 @@ +# coding: utf-8 + +#* token.rb - A parsed little bit of code extracted from the source. +module XfOOrth + + #A structure that holds vital info extracted from the source code. + Token = Struct.new(:code_fragment, :tag) do + + #Is this token tagged for immediate execution? + def immediate? + self.tag == :immediate + end + + #As a string for debugging. + def to_s + "Token: #{self.code_fragment} / type = #{self.tag.inspect}" + end + + end + +end \ No newline at end of file diff --git a/rakefile.rb b/rakefile.rb index 4856705..7cf44c5 100644 --- a/rakefile.rb +++ b/rakefile.rb @@ -29,6 +29,7 @@ RDoc::Task.new do |rdoc| "lib/fOOrth/compiler/file_source.rb", "lib/fOOrth/compiler/process.rb", "lib/fOOrth/compiler/parser.rb", + "lib/fOOrth/compiler/token.rb", "lib/fOOrth/main.rb", "lib/fOOrth/monkey_patch.rb", "lib/fOOrth/monkey_patch/object.rb", @@ -37,10 +38,13 @@ RDoc::Task.new do |rdoc| "lib/fOOrth/monkey_patch/complex.rb", "lib/fOOrth/monkey_patch/string.rb", "license.txt", - "README.txt"] + "readme.txt"] #Make all access levels visible. rdoc.options << '--visibility' << 'private' + + rdoc.options << '--title' << 'fOOrth Internals' + end #Run the fOOrth test suite. diff --git a/readme.txt b/readme.txt index 0d85059..3f05a0c 100644 --- a/readme.txt +++ b/readme.txt @@ -1,2 +1,29 @@ -This project contains the Ruby FlexArray gem. A gem used to facilitate the -creation and processing of multi-dimensional arrays in a flexible manner. \ No newline at end of file += The fOOrth Language gem. + +This file contains the read-me for the fOOrth language gem. The fOOrth +language is an experimental variant of FORTH that attempts to incorporate +object oriented and functional programming concepts. + +== Usage +Adding fOOrth can be as simple as: + + require 'fOOrth' + XfOOrth.main + +This will launch an interactive fOOrth session. +
If, instead, a non-interactive facility is required, use: + + require 'fOOrth' + XfOOrth.process_string '1 2 +' + +where the string is fOOrth code to be executed, or for a file of code, use: + + require 'fOOrth' + XfOOrth.process_file 'my_file.4th' + + +== Notes + +* Tested under ruby 1.9.3p484 (2013-11-22) [i386-mingw32] +* No notable dependencies. minitest, rake, rdoc and reek are used in development. +* I have used rdoc 4.0.1 here. Later versions of rdoc look like crap!