Main /

Ruby DVM Output From Third Sentence

Machine

Art

Social

Admin

edit SideBar

Ruby DVM Output From Third Sentence

Domain-formatted sentence

The (common way to (introduce (an add-in structure)) is to (load (libraries from (a specific directory)) at (runtime)).


If a Ruby DVM were to translate this (loosely speaking, since the code below is handwritten), it could be as follows:

SomeSymbol.rb

 class SomeSymbol
	def initialize(name)
		@name = name;
	end

	def relates_to(another_symbol, relationship)
		r = relationship.is_between(this, another_symbol);
		@relations.add(r);
		another_symbol.relates_to(this, r);
	end
 end

Relationship.rb

 class Relationship < SomeSymbol
  def initialize(name)
    super(name);
  end

  def initialize(name, lhsSymbol, rhsSymbol)
    super(name);
    @lhsSymbol = lhsSymbol;
    @rhsSymbol = rhsSymbol;
  end

  def is_between(lhsSymbol, rhsSymbol)
    Relationship.new(@name, lhsSymbol, rhsSymbol);
  end
 end

Sample.rb

 require "SomeSymbol.rb";
 require "Relationship.rb";

 add_in = SomeSymbol.new("add-in");
 any_directory = SomeSymbol.new("directory");
 specification = SomeSymbol.new("specific");

 a_specific_directory = 
Relationship.new("adjective", specification, any_directory); any_library = SomeSymbol.new("library"); libraries_from_a_specific_directory =
Relationship.new("from", any_library, a_specific_directory); load = SomeSymbol.new("load"); load_libraries_from_a_specific_directory =
Relationship.new("verb", load, libraries_from_a_specific_directory); runtime = SomeSymbol.new("runtime"); load_libraries_from_a_specific_directory_at_runtime =
Relationship.new("at", load_libraries_from_a_specific_directory, runtime); introduce = Relationship.new("introduce", add_in,
load_libraries_from_a_specific_directory_at_runtime);
Recent Changes (All) | Edit SideBar Page last modified on August 04, 2007, at 08:06 PM Edit Page | Page History
Powered by PmWiki