trexitycode / wirestate

MIT License
1 stars 0 forks source link

Refactor compiler to support new syntax rules #1

Closed dschnare closed 5 years ago

dschnare commented 5 years ago

NOTE: Please ignore the files in lib. These files are generated

New Syntax/Semantic Rules

@machine OtherApp State 1 State 2


- Files can be imported
- If no file extension is provided then `.wirestate` is assumed
- Cyclic dependencies are not supported

@import { OtherApp } from "file" // Same as above @import { OtherApp } from "file.wirestate"


- Machines can be used by other states via `@use {machine ID}`
- A machine can declare events that the state using the machine **must** define as transitions

// App.wirestate @import { Modal } from 'Modals'

@machine App State 1 close -> State 2 accept -> Saving Data @use Modal Saving Data data saved -> State 2 State 2

// Modals.wirestate @machine Modal State 1 <- close State 2 <- accept