class Ven::Compiler

Overview

A quote visitor that produces Ven unstitched chunks.

Ven bytecode instructions (Instruction) are organized into snippets (Snippet), which themselves are grouped into chunks (Chunk). It is the snippets' delimitation that makes us call the chunks unstitched.

The boundaries between snippets are dissolved during the process of stitching. Once this process is finished, the chunks are thought of as stitched.

puts Compiler.compile(quotes) # ==> unstitched chunks

Included Modules

Defined in:

ven/compile.cr

Constructors

Class Method Summary

Instance Method Summary

Instance methods inherited from class Ven::Suite::Visitor(Nil)

last=(last : Quote) last=, visit(quote : Quote)
visit(quotes : Quotes)
visit
, visit!(quote : _) visit!

Constructor Detail

def self.new(file : String = "untitled", context : Ven::Suite::Context::Compiler = Context::Compiler.new, origin : Int32 = 0) #

Makes a compiler.

No arguments are required, but file (for a file name), context (for a compiler context) and origin (for the point of origin of chunk emission) can be provided.


[View source]

Class Method Detail

def self.compile(quotes, file = "untitled", context = Context::Compiler.new, origin = 0) #

Makes a compiler, compiles quotes with it and disposes the compiler.

quotes are the quotes to-be-compiled; file is the filename under which they will be compiled; context is the compiler context of the compilation.

Returns unstitched chunks.


[View source]

Instance Method Detail

def visit(quote : QVoid) #

Passes without returning anything.


[View source]
def visit(quotes : Quotes) #

Visits each quote of quotes.


[View source]
def visit!(q : QRuntimeSymbol) #

[View source]
def visit!(q : QReadtimeSymbol) #

[View source]
def visit!(q : QNumber) #

[View source]
def visit!(q : QString) #

[View source]
def visit!(q : QRegex) #

[View source]
def visit!(q : QVector) #

[View source]
def visit!(q : QUPop) #

[View source]
def visit!(q : QURef) #

[View source]
def visit!(q : QUnary) #

[View source]
def visit!(q : QBinary) #

[View source]
def visit!(q : QAssign) #

[View source]
def visit!(q : QBinaryAssign) #

[View source]
def visit!(q : QCall) #

[View source]
def visit!(q : QDies) #

[View source]
def visit!(q : QIntoBool) #

[View source]
def visit!(q : QReturnIncrement) #

[View source]
def visit!(q : QReturnDecrement) #

[View source]
def visit!(q : QAccessField) #

[View source]
def visit!(q : QReduceSpread) #

[View source]
def visit!(q : QMapSpread) #

[View source]
def visit!(q : QIf) #

[View source]
def visit!(q : QBlock) #

[View source]
def visit!(q : QGroup) #

[View source]
def visit!(q : QEnsure) #

[View source]
def visit!(q : QFun) #

[View source]
def visit!(q : QInfiniteLoop) #

[View source]
def visit!(q : QBaseLoop) #

[View source]
def visit!(q : QStepLoop) #

[View source]
def visit!(q : QComplexLoop) #

[View source]
def visit!(q : QNext) #

[View source]

[View source]
def visit!(q : QBox) #

[View source]