class Ven::Program

Overview

An individual Ven program, and a first-tier (higher is more abstract) high level manager.

High level managers are abstractions over the workhorses of Ven: Reader, Compiler, Optimizer and Machine. They manage the workhorses in a simple, graceful and powerful way.

puts Program.new("1 + 1").run # 2 : Num

Included Modules

Defined in:

ven/program.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(source : String, file : String = "untitled", hub : Ven::Suite::Context::Hub = Context::Hub.new, legate : Ven::Legate = Legate.new) #

Makes a Program.

source is the source code of this program; file is its filename (or unit name); hub is the context hub that this program will use.


[View source]

Instance Method Detail

def chunks : Array(Ven::Suite::Chunk) #

Returns the chunks of this program.


[View source]
def distinct : Distinct | Nil #

Returns this program's distinct.


[View source]
def export(destination : Chunks) #

Appends the chunks that (exclusively) this program produced to destination.

Returns self.

NOTE Mutates destination.


[View source]
def exposes : Array(Array(String)) #

Returns the distincts that this program exposes.


[View source]
def file : String #

Returns the filename (or unit name) of this program.


[View source]
def hub : Context::Hub #

Returns the context hub of this program.


[View source]
def import(pool : Chunks) #

Makes chunks of pool precede chunks of this program, as well as be available at runtime.

Returns self.


[View source]
def quotes : Array(Ven::Suite::Quote) #

Returns the quotes of this program.


[View source]
def run(with parenthood = [] of Chunk) #

Runs this program: performs all steps of Ven evaluation pipeline.

parenthood gets #imported first, and then gets #exported. See these methods to find out about the details.

Returns self.


[View source]
def source : String #

Returns the source code of this program.


[View source]
def step(step : Step) #

Performs a particular step in Ven program evaluation pipeline.

See Step for the available steps.


[View source]
def then(*args, **options) #

Alias for #step.


[View source]
def to_s(io) #

Appends the result of this program's evaluation of the string representation for an unevaluated program to io.


[View source]