-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #493 from nasa/feature/state-machine-phase-1
Phase 1 state machines
- Loading branch information
Showing
177 changed files
with
7,584 additions
and
2,732 deletions.
There are no files selected for viewing
1,862 changes: 979 additions & 883 deletions
1,862
compiler/lib/src/main/resources/META-INF/native-image/reflect-config.json
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
compiler/lib/src/main/scala/analysis/Semantics/StateMachineInstance.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package fpp.compiler.analysis | ||
|
||
import fpp.compiler.ast._ | ||
import fpp.compiler.util._ | ||
|
||
/** An FPP state machine instance */ | ||
final case class StateMachineInstance( | ||
aNode: Ast.Annotated[AstNode[Ast.SpecStateMachineInstance]], | ||
symbol: Symbol.StateMachine, | ||
priority: Option[BigInt], | ||
queueFull: Ast.QueueFull | ||
) { | ||
|
||
/** Gets the location of the state machine instance*/ | ||
def getLoc: Location = Locations.get(aNode._2.id) | ||
|
||
def getNodeId = aNode._2.id | ||
|
||
/** Gets the name of the state machine instance */ | ||
def getName = aNode._2.data.name | ||
|
||
} | ||
|
||
object StateMachineInstance { | ||
|
||
/** Creates a state machine instance from a state machine instance specifier */ | ||
def fromSpecStateMachine(a: Analysis, | ||
aNode: Ast.Annotated[AstNode[Ast.SpecStateMachineInstance]] | ||
) : Result.Result[StateMachineInstance] = { | ||
val data = aNode._2.data | ||
val qid = data.stateMachine | ||
val priorityNode = data.priority | ||
val priority = a.getBigIntValueOpt(priorityNode) | ||
val queueFull = Analysis.getQueueFull(data.queueFull) | ||
|
||
for { | ||
symbol <- a.useDefMap(qid.id) match { | ||
case symbol @ Symbol.StateMachine(_) => Right(symbol) | ||
case symbol => Left(SemanticError.InvalidSymbol( | ||
symbol.getUnqualifiedName, | ||
Locations.get(qid.id), | ||
"not a state machine symbol", | ||
symbol.getLoc | ||
)) | ||
} | ||
} | ||
yield StateMachineInstance(aNode, symbol, priority, queueFull) | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.