simple type language DSL
expression = { ekind object }
ekind = 'true' | 'false' | 'object' | 'calledObject'
object = { name fieldMap }
fieldMap = :map field
field = { name fkind actualParameterList }
fkind = 'map' | 'simple'
actualParameterList = :map expression
name = :string


construct meaning
expression = { ekind object } create a class called “expression” with two fields ‘ekind’ and ‘object’
ekind = 'true' | 'false' | 'object' | 'calledObject' create enum with 4 possible symbols (true, false, object, calledObject)
fieldMap = :map field create a type called ‘fieldMap’ that can be iterated in order, containing objects of type ‘field’
name = :string create a string called ‘name’
xxx = :bag yyy create an object called ‘xxx’ which is an unordered bag of type ‘yyy’ objects
aaa =| xxx | yyy | zzz create a type called ‘aaa’ which can be one of the types ‘xxx’, ‘yyy’ or ‘zzz’





N.B. Every created type has two stacks – I called them ‘input-<xxx>’ and ‘output-<xxx>’, although, in retrospect, the ‘input-<xxx>’ might have been called ‘work-<xxx>’ and, it is arguable if a second stack ‘output-<xxx>’ is needed at all (having 2 stacks made design easier – rhetorical question: is the number of stacks variable? Is 2 the magic number?)



N.B. see https://github.com/bmfbp/bmfbp/blob/v2emitter/build_process/esa-transpiler/exprtypes.dsl for a full-blown example



N.B. see https://github.com/guitarvydas/stack-dsl for a full implementation