2022-09-11 15:22:07 +00:00
|
|
|
type environment = GenericDist.env
|
|
|
|
|
|
|
|
@genType.opaque
|
|
|
|
type rec value =
|
|
|
|
| IEvArray(arrayValue)
|
|
|
|
| IEvBool(bool)
|
|
|
|
| IEvDate(Js.Date.t)
|
|
|
|
| IEvDeclaration(lambdaDeclaration)
|
|
|
|
| IEvDistribution(DistributionTypes.genericDist)
|
|
|
|
| IEvLambda(lambdaValue)
|
|
|
|
| IEvNumber(float)
|
|
|
|
| IEvRecord(map)
|
|
|
|
| IEvString(string)
|
|
|
|
| IEvTimeDuration(float)
|
|
|
|
| IEvType(map)
|
|
|
|
| IEvTypeIdentifier(string)
|
|
|
|
| IEvVoid
|
|
|
|
@genType.opaque and arrayValue = array<value>
|
|
|
|
@genType.opaque and map = Belt.Map.String.t<value>
|
2022-09-11 16:57:28 +00:00
|
|
|
and lambdaBody = (array<value>, environment, reducerFn) => value
|
2022-09-11 15:22:07 +00:00
|
|
|
@genType.opaque
|
2022-09-11 16:57:28 +00:00
|
|
|
and lambdaValue = {
|
2022-09-12 09:33:20 +00:00
|
|
|
parameters: array<string>,
|
2022-09-16 20:30:44 +00:00
|
|
|
body: lambdaBody,
|
2022-09-12 09:33:20 +00:00
|
|
|
}
|
2022-09-11 15:22:07 +00:00
|
|
|
@genType.opaque and lambdaDeclaration = Declaration.declaration<lambdaValue>
|
|
|
|
and expression =
|
|
|
|
| EBlock(array<expression>)
|
2022-09-16 20:30:44 +00:00
|
|
|
// programs are similar to blocks, but don't create an inner scope. there can be only one program at the top level of the expression.
|
|
|
|
| EProgram(array<expression>)
|
2022-09-11 15:22:07 +00:00
|
|
|
| EArray(array<expression>)
|
2022-09-11 19:56:07 +00:00
|
|
|
| ERecord(array<(expression, expression)>)
|
2022-09-11 15:22:07 +00:00
|
|
|
| ESymbol(string)
|
|
|
|
| ETernary(expression, expression, expression)
|
|
|
|
| EAssign(string, expression)
|
|
|
|
| ECall(expression, array<expression>)
|
|
|
|
| ELambda(array<string>, expression)
|
|
|
|
| EValue(value)
|
|
|
|
|
2022-09-17 22:19:08 +00:00
|
|
|
and namespace = Belt.Map.String.t<value>
|
2022-09-16 20:30:44 +00:00
|
|
|
and bindings = {
|
|
|
|
namespace: namespace,
|
|
|
|
parent: option<bindings>,
|
|
|
|
}
|
|
|
|
|
2022-09-11 15:22:07 +00:00
|
|
|
and context = {
|
2022-09-16 20:30:44 +00:00
|
|
|
bindings: bindings,
|
2022-09-11 15:22:07 +00:00
|
|
|
environment: environment,
|
|
|
|
}
|
|
|
|
|
2022-09-17 22:19:08 +00:00
|
|
|
and reducerFn = (expression, context) => (value, context)
|