Skip to content

Commit

Permalink
evaluateDefinition -- TransitionDefinition
Browse files Browse the repository at this point in the history
- return add transition to current net, and return the transition value
  • Loading branch information
xieyuheng committed Nov 16, 2023
1 parent 509b847 commit 9d567dc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
14 changes: 6 additions & 8 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
evaluateBlockStmt -- Connect
evaluateBlockStmt -- LetPlace

execute -- DefineTransition -- call evaluate and define
execute -- Begin -- `createEnv` and run

- [maybe] Mod -- has no env -- top level `evaluate`

evaluateDefinition -- TransitionDefinition

- return transition value

[connect] connectTransitionToInputs(net: Net, transition: Transition, places: Array<Place>)
[connect] connectTransitionToOutputs(net: Net, transition: Transition, places: Array<Place>)

evaluateBlockStmt -- Connect
evaluateBlockStmt -- LetPlace

# builtins

Expand All @@ -17,9 +18,6 @@ evaluateDefinition -- TransitionDefinition

# net

[connect] connectTransitionToInputs(net: Net, transition: Transition, places: Array<Place>)
[connect] connectTransitionToOutputs(net: Net, transition: Transition, places: Array<Place>)

[run] run

- everytime a marking changes,
Expand Down
9 changes: 8 additions & 1 deletion src/lang/evaluate/evaluateDefinition.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Definition } from "../definition"
import { Env } from "../env"
import { addTransition } from "../net"
import { Value } from "../value"
import { EvaluateOptions } from "./evaluate"

Expand All @@ -10,7 +11,13 @@ export function evaluateDefinition(
): Value {
switch (definition["@kind"]) {
case "TransitionDefinition": {
throw new Error("TODO")
return addTransition(
env.net,
env.mod,
definition.name,
definition.inputParameters,
definition.outputParameters,
)
}
}
}

0 comments on commit 9d567dc

Please sign in to comment.