Documentation
¶
Overview ¶
Package lang is the mcl language frontend that implements the reactive DSL that lets users model their desired state over time.
Index ¶
Constants ¶
const ( // EngineStartupStatsTimeout is the amount of time in seconds to wait // between engine startup, and loaded event before printing some // debugging stats. This is useful for finding bugs in the function // engine. Set to zero to disable. EngineStartupStatsTimeout = 60 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Data ¶
type Data struct { // UnificationStrategy is a hack to tune unification performance until // we have an overall cleaner unification algorithm in place. UnificationStrategy map[string]string }
Data is some data that is passed into the Lang struct. It is presented here as a single struct with room for multiple fields so that it can be changed or extended in the future without having to re-plumb through all the fields it contains
type Lang ¶
type Lang struct { Fs engine.Fs // connected fs where input dir or metadata exists FsURI string // Input is a string which specifies what the lang should run. It can // accept values in several different forms. If is passed a single dash // (-), then it will use `os.Stdin`. If it is passed a single .mcl file, // then it will attempt to run that. If it is passed a directory path, // then it will attempt to run from there. Instead, if it is passed the // path to a metadata file, then it will attempt to parse that and run // from that specification. If none of those match, it will attempt to // run the raw string as mcl code. Input string // Data is some additional data for the lang struct. Data *Data Hostname string Local *local.API World engine.World Prefix string Debug bool Logf func(format string, v ...interface{}) // contains filtered or unexported fields }
Lang is the main language lexer/parser object.
func (*Lang) Init ¶
Init initializes the lang struct, and starts up the initial input parsing. NOTE: The trick is that we need to get the list of funcs to watch AND start watching them, *before* we pull their values, that way we'll know if they changed from the values we wanted.
func (*Lang) Interpret ¶
Interpret runs the interpreter and returns a graph and corresponding error.
Directories
¶
Path | Synopsis |
---|---|
Package ast contains the structs implementing and some utility functions for interacting with the abstract syntax tree for the mcl language.
|
Package ast contains the structs implementing and some utility functions for interacting with the abstract syntax tree for the mcl language. |
Package core contains core functions and other related facilities which are used in programs.
|
Package core contains core functions and other related facilities which are used in programs. |
Package download is used for downloading language modules from git.
|
Package download is used for downloading language modules from git. |
Package embedded embeds mcl modules into the system import namespace.
|
Package embedded embeds mcl modules into the system import namespace. |
Package funcs provides a framework for functions that change over time.
|
Package funcs provides a framework for functions that change over time. |
dage
Package dage implements a DAG function engine.
|
Package dage implements a DAG function engine. |
facts
Package facts provides a framework for language values that change over time.
|
Package facts provides a framework for language values that change over time. |
funcgen/util
Package util provides some functions to be imported by the generated file.
|
Package util provides some functions to be imported by the generated file. |
operators
Package operators provides a helper library to load all of the built-in operators, which are actually just functions.
|
Package operators provides a helper library to load all of the built-in operators, which are actually just functions. |
ref
Package ref implements reference counting for the graph API and function engine.
|
Package ref implements reference counting for the graph API and function engine. |
txn
Package txn contains the implementation of the graph transaction system.
|
Package txn contains the implementation of the graph transaction system. |
vars
Package vars provides a framework for language vars.
|
Package vars provides a framework for language vars. |
Package gapi is the Graph API implementation for the mcl language frontend.
|
Package gapi is the Graph API implementation for the mcl language frontend. |
Package inputs contains the input parsing logic for how mcl module entrypoints are handled for the language.
|
Package inputs contains the input parsing logic for how mcl module entrypoints are handled for the language. |
Package interfaces contains the common interfaces used in the mcl language.
|
Package interfaces contains the common interfaces used in the mcl language. |
Package interpolate contains the string interpolation parser and associated structs and code.
|
Package interpolate contains the string interpolation parser and associated structs and code. |
Package interpret contains the implementation of the actual interpret function that takes an AST and returns a resource graph.
|
Package interpret contains the implementation of the actual interpret function that takes an AST and returns a resource graph. |
Package parser contains the lexer and parser for the mcl language.
|
Package parser contains the lexer and parser for the mcl language. |
Package types provides a framework for our mcl language values and types.
|
Package types provides a framework for our mcl language values and types. |
Package unification contains the code related to type unification for the mcl language.
|
Package unification contains the code related to type unification for the mcl language. |
fastsolver
Package fastsolver implements very fast type unification.
|
Package fastsolver implements very fast type unification. |
solvers
Package solvers is used to have a central place to import all solvers from.
|
Package solvers is used to have a central place to import all solvers from. |
util
Package util contains some utility functions and algorithms which are useful for type unification.
|
Package util contains some utility functions and algorithms which are useful for type unification. |
Package util contains utility functions that are specific to the mcl language.
|
Package util contains utility functions that are specific to the mcl language. |