Sample: A Pedestrian Crossing Controller

This example implements a traffic light controlled pedestrian crossing. The user interface is implemented as a Windows forms application, and displays a traffic light, and a pedestrian control. When the pedestrian presses the 'Cross' button, the traffic light sequences to Red via Yellow, then indicates to the pedestrian that it is safe to cross. After a crossing period, the pedestrian indicator switches to an indication that it is no longer safe to cross, then after a safety interval the light sequences back to green to allow vehicles to move again.

This sample demonstrates the use of an inline state machine, with actions written into the user's state machine class, but called from the transitions in the grammar description.

The sample code for the application is divided into two projects. TrafficLightDemo contains the windows forms GUI, and TrafficLightController contains the implementation of the finite state machine, built using the grammar-generated state machines of the ParseLR toolkit.

The source code and grammar files for the projects in this example are included in the parser toolkit download file ParseLR.zip, and when unzipped will be found in the TrafficLightControllerExample folder.