0
comment
comment
on 3/31/2015 10:57 PM
Just before Christmas I came across some Java source code by “Uncle” Bob Martin aimed at “demystifying compilers” which expends about 600 lines of code to parse the following simple finite state machine: Actions: Turnstile
FSM: OneCoinTurnstile
Initial: Locked
{
Locked Coin Unlocked {alarmOff unlock}
Locked Pass Locked alarmOn
Unlocked Coin Unlocked thankyou
Unlocked Pass Locked lock
}
For fun I knocked up a broadly equivalent parser in F# using FParsec which was just under 40 lines of code, and posted [...]