View this PageEdit this PageAttachments to this PageHistory of this PageHomeRecent ChangesSearch the SwikiHelp Guide
Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007

State Machines/Parsing/Educational Languages in Squeak

Derek Perry
CS2340 Extra Credit Essay
12/03/2001
State Machines in Squeak
Can you use Squeak to control a garage door; a dishwasher; a car? Currently there is no support for deterministic finite automata, or non-deterministic finite automata within Squeak. Can you write an expression that calculates every leap year in history? No, because just like the state machine problem, regular expressions are not contained within Squeak. Is Squeak easy for entry-level programmers? No, but a new language could be developed on top of Squeak which utilizes these tools to make a very user-friendly and safe language. Squeak is lacking in these related categories and could be improved for more widespread usage among educational institutes and professionals.
Writing a scanner-generator (see Lex in C) in Squeak, or using TGen, would be a huge addition to the language. The WordMatcher from M1 would have been a series of rules and actions to do when those rules are encountered instead of a jumble of loops, OrderedCollections, and unclear code. This new utility would generate a class that has matches for regular expressions, which would allow Squeak to scan and the parse (see Yacc in C) any file and organize it into a logical format or program. This addition to the language would make it easy to write a browser program or even a new language specification that could be written on top of the Squeak platform. This important class would add much functionality to the core of the Squeak programming language.
State machine functionality within Squeak would allow the language to control devices in everyday life easily. Enumerating several integers within Squeak and writing a deterministic finite automata, or non-deterministic finite automata that can control a device easily is where Squeak could use some improvement. This could also allow the creation of a language that could be written upon the Squeak VM-based environment such as a programming language for kids that has very few commands and lets them draw and animate (see Logo) on a canvas set up by Squeak for their use.
Using these two new Squeak classes a programmer could set up a parser that recognizes states that controls something as complicated as a missile, with a few hundred states, or even as simple as a garage door, with only a few states. Also, as previously mentioned, a new language specification could be invented involving very simple commands that can do relatively simple tasks based upon the previously existing Squeak methods and classes. A command like make box, or make box bigger, would execute background Squeak code in a MVC or Morphic environment that would do the low-level coding involving the pen and the points. This would be extremely useful for people who are just learning to program and need something light on syntax and fairly easy to learn. This new “language,” run on top of the Squeak VM would protect them and their computer from coding errors sufficiently. This could be a very strong point for Squeak, because after using the make up language, the user could transition into Squeak and more powerful languages more easily.
In conclusion, Squeak could build upon itself and make an educational learning language utilizing tools added into the language specification so more entry-level programmers can get a strong object-oriented base in programming. This would elevate Squeak use to more educational institutes and would encourage use of Squeak as a further programming language in their classes.

Link to this Page