Module: Stone
- Defined in:
- lib/stone/types.rb,
lib/stone.rb,
lib/stone/ast.rb,
lib/stone/libc.rb,
lib/stone/rtti.rb,
lib/stone/type.rb,
lib/stone/error.rb,
lib/stone/scope.rb,
lib/stone/grammar.rb,
lib/stone/ast/block.rb,
lib/stone/built_ins.rb,
lib/stone/transform.rb,
lib/stone/ast/lambda.rb,
lib/stone/type_context.rb,
lib/stone/ast/reference.rb,
lib/stone/type_registry.rb,
lib/stone/ast/expression.rb,
lib/stone/error/overflow.rb,
lib/extensions/llvm_module.rb,
lib/stone/ast/null_literal.rb,
lib/stone/ast/program_unit.rb,
lib/stone/error/type_error.rb,
lib/stone/ast/function_call.rb,
lib/stone/error/arity_error.rb,
lib/stone/ast/string_literal.rb,
lib/stone/ast/type_reference.rb,
lib/stone/ast/boolean_literal.rb,
lib/stone/ast/integer_literal.rb,
lib/stone/ast/property_access.rb,
lib/stone/ast/type_annotation.rb,
lib/stone/ast/type_declaration.rb,
lib/stone/error/argument_error.rb,
lib/stone/error/property_error.rb,
lib/stone/ast/record_definition.rb,
lib/stone/error/reference_error.rb,
lib/stone/ast/type_of_expression.rb,
lib/stone/ast/constant_definition.rb,
lib/stone/ast/record_instantiation.rb,
lib/stone/ast/two_phase_processing.rb,
lib/stone/ast/union_type_annotation.rb,
lib/stone/ast/function_type_annotation.rb,
lib/stone/ast/program_unit/top_function.rb,
lib/stone/ast/computed_property_definition.rb
Overview
TODO: Eventually, TRUE and FALSE should be top-level constants defined as
BUILTIN.Boolean.TRUE and BUILTIN.Boolean.FALSE rather than literals.
Defined Under Namespace
Modules: LLVMModuleExtensions, LibC, Types
Classes: AST, ArgumentError, ArityError, BuiltIns, Error, Grammar, PropertyError, RTTI, ReferenceError, Scope, Transform, Type, TypeContext, TypeError, TypeRegistry
Constant Summary
collapse
- TypeInstance =
Backwards compatibility alias (deprecated - use Stone::Type directly)
Type
Class Method Summary
collapse
Class Method Details
.compile(input) ⇒ Object
41
42
43
44
45
|
# File 'lib/stone.rb', line 41
def self.compile(input)
input_with_prelude = prepend_prelude(input)
parse_tree = parse(input_with_prelude)
transform(parse_tree)
end
|
.eval(input) ⇒ Object
59
60
61
62
|
# File 'lib/stone.rb', line 59
def self.eval(input)
ast = compile(input)
ast.eval
end
|
.eval_with_scope(input) ⇒ Object
.parse(input) ⇒ Object
31
32
33
|
# File 'lib/stone.rb', line 31
def self.parse(input)
Stone::Grammar.parse(input)
end
|
.prelude_code ⇒ Object
51
52
53
|
# File 'lib/stone.rb', line 51
def self.prelude_code
@prelude_code ||= File.read(prelude_path)
end
|
.prelude_path ⇒ Object
55
56
57
|
# File 'lib/stone.rb', line 55
def self.prelude_path
File.expand_path("stone/prelude.stone", __dir__)
end
|
.prepend_prelude(input) ⇒ Object
47
48
49
|
# File 'lib/stone.rb', line 47
def self.prepend_prelude(input)
"#{prelude_code}\n#{input}"
end
|
35
36
37
38
|
# File 'lib/stone.rb', line 35
def self.transform(parse_tree)
transformer = Stone::Transform.new
transformer.transform(parse_tree)
end
|