Fault-lang / Fault

a language for building system dynamic models
https://fault.tech
MIT License
165 stars 6 forks source link

Tighten Up AST with Operand Type #10

Closed mbellotti closed 1 year ago

mbellotti commented 2 years ago

Recently introduced an Operand Type which encompasses both Identifiers and Struct Properties (ParameterCall). This opens up the opportunity to tighten up the AST, which currently allows any Expression node to be inserted into places where clearly only operands would work.

An example:

type ParallelFunctions struct {
    Token        Token
    InferredType *Type
    Expressions  []Expression
}

Areas affected: ParallelFunctions - Fault specs have run blocks where the logic of what happens in a single loop of the model is defined. Multiple functions can execute in parallel. IndexExpression - Not yet fully implemented but allows historic values to be accessed in the model. Typically looks like foo[3] StockLiteral - Pairs are defined as map[Expression]Expression but keys can't be anything other than Identifiers FlowLiteral - See above ComponentLiteral - See above

mbellotti commented 1 year ago

This was actually done ages ago. Cleaning up old issues :)