Pure MoonBit parser, interpreter, and typechecker experiments for Apple's Pkl language.
Dependencies
pub struct AnalysisSession {
// private fields
}fn AnalysisSession::eval_path_with_runtime_metadata(self : AnalysisSession, path : String) -> EvalResultpub(all) struct Annotation {
class_name : String
body_kind : AnnotationBodyKind
body_text : String
} derive(Eq, Debug)pub(all) struct Binding {
name : String
type_name : String?
value : Expr
exported : Bool
is_const : Bool
annotations : Array[Annotation]
abstract_slot : Bool
sibling_slot : Bool
} derive(Eq, Debug)pub(all) struct ClassDecl {
name : String
type_parameters : Array[String]
type_parameter_bounds : Array[String?]
parent_name : String?
properties : Array[ClassProperty]
methods : Array[FunctionDecl]
annotations : Array[Annotation]
is_abstract : Bool
} derive(Eq, Debug)pub(all) struct ClassExport {
name : String
parent_name : String?
properties : Array[ClassProperty]
methods : Array[FunctionDecl]
} derive(Eq, Debug)pub(all) struct ClassProperty {
name : String
type_name : String?
value : Expr?
annotations : Array[Annotation]
} derive(Eq, Debug)pub(all) enum Declaration {
ClassDeclaration(ClassDecl)
FunctionDeclaration(FunctionDecl)
TypeAliasDeclaration(TypeAliasDecl)
} derive(Eq, Debug)pub struct EvalThunkCell {
// private fields
}impl Eq for EvalThunkCellimpl Debug for EvalThunkCellpub(all) enum Expr {
IntLiteral(Int64)
FloatLiteral(Double)
BoolLiteral(Bool)
StringLiteral(String)
NullLiteral
Identifier(String)
ImportExpr(String)
ImportGlobExpr(String)
ObjectLiteral(Array[ObjectMember])
TypedObjectLiteral(String, Array[ObjectMember])
ListingLiteral(Array[Expr])
MappingLiteral(Array[MappingEntry])
MemberAccess(Expr, String)
SafeMemberAccess(Expr, String)
SubscriptAccess(Expr, Expr)
AmendExpr(Expr, Array[ObjectMember])
CallExpr(Expr, Array[Expr])
LambdaExpr(Array[FunctionParameter], Expr, String?)
LetExpr(String, String?, Expr, Expr)
NonNullExpr(Expr)
UnaryExpr(UnaryOp, Expr)
BinaryExpr(BinaryOp, Expr, Expr)
ConditionalExpr(Expr, Expr, Expr)
ForGenerator(String, String?, Expr, Array[ObjectMember], String?, String?)
WhenSpread(Expr)
InterpolatedString(Array[Expr])
NullSafeCallExpr(Expr, Array[Expr])
UnsupportedExpr
ErrorExpr(String)
} derive(Eq, Debug)pub(all) struct FunctionDecl {
name : String
type_parameters : Array[String]
type_parameter_bounds : Array[String?]
parameters : Array[FunctionParameter]
return_type_name : String?
body : Expr?
annotations : Array[Annotation]
is_const : Bool
is_abstract : Bool
} derive(Eq, Debug)pub(all) struct ObjectMember {
name : String
type_name : String?
value : Expr
annotations : Array[Annotation]
} derive(Eq, Debug)pub(all) struct ParseResult {
root : SyntaxNode
program : Program
diagnostics : Array[Diagnostic]
unsupported_syntax : Array[UnsupportedSyntax]
} derive(Eq)pub(all) struct Program {
module_name : String?
module_relation : ModuleRelation?
imports : Array[ImportDecl]
declarations : Array[Declaration]
bindings : Array[Binding]
body : Expr?
module_annotations : Array[Annotation]
} derive(Eq, Debug)pub(all) enum Type {
IntType
FloatType
BoolType
StringType
NullType
ObjectType(Array[TypeMember])
ClassType(String, Array[TypeMember])
ListingType(Array[Type])
MappingType(Array[TypeEntry])
PairType(Type, Type)
IntSeqType
SetType(Array[Type])
MapType(Array[TypeEntry])
FunctionType(Array[Type], Type)
ConstrainedType(String, Type)
UnionType(Array[Type])
NullableType(Type)
DefaultedType(Type)
TypeVariable(String)
AnyType
UnknownType
} derive(Eq, Debug)pub(all) struct TypeAliasDecl {
name : String
type_parameters : Array[String]
target : String
annotations : Array[Annotation]
} derive(Eq, Debug)pub(all) enum Value {
IntValue(Int64)
FloatValue(Double)
BoolValue(Bool)
StringValue(String)
NullValue
DeferredImportValue(String)
ThunkValue(EvalThunkCell)
ObjectValue(Array[ValueMember])
ListingValue(Array[Value])
ListValue(Array[Value])
MappingValue(Array[ValueEntry])
DefaultedListingValue(Array[Value], Array[Value], Value)
DefaultedMappingValue(Array[ValueEntry], Array[ValueEntry], Value)
PairValue(Value, Value)
IntSeqValue(Int64, Int64, Int64)
SetValue(Array[Value])
MapValue(Array[ValueEntry])
FunctionValue(Array[FunctionParameter], Expr, String?, Array[ValueBinding], Int)
DurationValue(Double, String)
DataSizeValue(Double, String)
RegexValue(String)
BytesValue(Bytes)
} derive(Eq, Debug)pub(all) struct ValueMember {
name : String
value : Value
annotations : Array[Annotation]
source : Expr?
} derive(Debug)fn clear_sandbox_resource_readers() -> Unitfn configure_pklbinary_module_uri_normalizer(normalizer : (String) -> String) -> Unitfn configure_sandbox_resource_reader(scheme : String, reader : (String) -> SandboxResource?) -> Unitfn configure_stdlib_base_paths(loader : () -> String?) -> Unitfn configure_stdlib_base_source(source : String) -> Unitfn lookup_triple_dot_resolution(from : String, uri : String) -> String?fn register_import_glob_errors(from : String, pattern : String, errors : Map[String, String]) -> Unitfn register_module_alias(raw : String, resolved : String) -> Unitfn register_read_resource(from : String, uri : String, visible_uri : String, resource_uri : String, text : String) -> Unitfn register_triple_dot_resolution(from : String, uri : String, resolved : String) -> Unitfn render_value_as_jsonnet_document_with_options(value : Value, indent_text : String, omit_null_properties : Bool) -> Stringfn render_value_as_jsonnet_with_options(value : Value, indent_text : String, omit_null_properties : Bool) -> Stringfn render_value_as_pcf_document_with_options(value : Value, indent_text : String, use_custom_string_delimiters : Bool) -> Stringfn render_value_as_pcf_fragment_with_options(value : Value, indent_text : String, use_custom_string_delimiters : Bool) -> Stringfn render_value_as_pklbinary_with_module(value : Value, module_name : String, module_uri : String) -> Bytesfn render_value_as_xml_with_options(value : Value, root_element_name : String, indent_text : String, xml_version : String) -> Stringfn render_value_as_yaml_fragment_with_mode(value : Value, indent_width : Int, is_stream : Bool, mode : String) -> Stringfn render_value_as_yaml_fragment_with_options(value : Value, indent_width : Int, is_stream : Bool) -> Stringfn render_value_as_yaml_with_mode(value : Value, indent_width : Int, is_stream : Bool, mode : String) -> Stringfn render_value_with_pcf_options(value : Value, indent_text : String, use_custom_string_delimiters : Bool) -> Stringfn sandbox_is_module_allowed(uri : String) -> BoolPure MoonBit parser, interpreter, and typechecker experiments for Apple's Pkl language.
Dependencies