# domain specific language
A domain-specific language is created specifically to solve problems in a particular domain and is not intended to be able to solve problems outside of it (although that may be technically possible)
# category
- internal dsl
- external dsl
- Language Workbench(dsl gui)
# relationship
# understandability
workbench > external dsl > internal dsl(declarative) > command-query api (imperative)
# difficulty
workbench > external dsl > internal dsl(declarative) > command-query api (imperative)
# when should i use it
when the benefits of using a dsl outweigh the cost of building it
# simple tutorial (external dsl)
base domain specific language book and use typescript translate
# state machine model

# custom syntax
events
doorClosed D1CL
drawerOpened D2OP
lightOn L1ON
doorOpened D1OP
panelClosed PNCL
end
resetEvents
doorOpened
end
commands
unlockPanel PNUL
lockPanel PNLK
lockDoor D1LK
unlockDoor D1UL
end
state idle
actions {unlockDoor lockPanel}
doorClosed => active
end
state active
drawerOpened => waitingForLight
lightOn => waitingForDrawer
end
state waitingForLight
lightOn => unlockedPanel
end
state waitingForDrawer
drawerOpened => unlockedPanel
end
state unlockedPanel
actions {unlockPanel lockDoor}
panelClosed => idle
end
# lexical parser
process: input > scannerPatterns scanRecognizer > tokens > stateMachineTokenizer
# syntax parser
# parser combinators
# parser generator(antlr)
# other
wikipedia dsl (opens new window)
jetbrains dsl (opens new window)
domain specific language (opens new window)