KEGGeneratorFiniteStateMachines

SqueakSource3 project page

The KEGGeneratorFiniteStateMachines library will help you to implement FiniteStateMachines on top of KEGGenerators. You do this using the KEGGenerator>>sortInto: Method. Please see KEGGeneratorTest>>testsortIntoC for lots of simple examples. Please see the KEGGeneratorScanReplace and KEGGeneratorScanReplaceTest Projects for more complex examples using more than two states( You can probably find these in the ConfigurationBrowser on the WorldMenu on the Pharo Window desktop ). It seems easy to enhance these FiniteStateMachines with BlockClosures or Objects that respond to >>value: and >>value:value: so that they recognize more complex things with a few states than FSMs can usually recognize. This is by adding variables and what not to the BlockClosures. You might even add stacks to them. To get a context free sort of functionality. So if you need a simple FSM in just a few lines of code that works on a sequence of Objects then KEGGeneratorFiniteStateMachines is what you need. If you need a FSM with a lot of states like 20 or more that is very complex then use the KEGFiniteStateMachineV1 Project with the KEGGeneratorParsing Project using the KEGGenerator>>lexUsingFiniteStateMachine: which has been used to lex the BorgLisp LambdaLisp dialect with something like 10 states or more and about 8 transitions per state. But these may not be ported from Dolphin Smalltalk to Pharo by the time you read this. If so then contact me to bug me.
KEGGeneratorFiniteStateMachines is a library that implements Smalltalk Generators like those found in the book A Little Smalltalk. It is well documented in the Method comments. The main documentation is in the public Methods in the KEGGenerator Class that all have long comments. There are 4 TestCase(s) which you can find in the test runner by looking for the KEGTestCaseObject Class and selecting its KEGGenerator subClass to run the tests. These tests are designed to show lots of examples of how to get all of the basic functionality of each generator Method to work. They show basic one line examples of each Method but they don`t really give a flavor of how KEGGenerators are used in practice. Here is how you load the KEGGeneratorFiniteStateMachines Packages into a virgin image. First you right click on the Pharo desktop and then open the Monticello browser. Hit the +Repository button. Select HTTP. Below on this webpage see the Monticello Registration. Click on it and copy the text String. Right click copy. Paste the String into the Monticello dialog. ( Make 'Kjell E Godo' become '' if needed so there will not be a password check. Or if you get a password check click cancel. ) Click OK. A new Repository browser will open. In the left pane click on the ConfigurationOfKEGGeneratorFiniteStateMachines Package .mcz file with the highest version number. It should look something like ConfigurationOfKEGGeneratorFiniteStateMachines-KjellGodo.1.mcz. Click the Load button. It should load. Now open a Workspace and evaluate the following to exclude the testing Packages : ( ( ConfigurationOfKEGGeneratorFiniteStateMachines project version: '1.0' ) load ). To include the testing Packages evaluate the following : ( ( ConfigurationOfKEGGeneratorFiniteStateMachines project version: '1.0' ) load: 'Tests' ) I hope you will give KEGGeneratorFiniteStateMachines a try. Contact me at picoVerse att gMail dott com. There is a google group for this library at https://groups.google.com/forum/?hl=en&fromgroups=#!forum/keggenerators . KEGGeneratorFiniteStateMachines now work with Pharo 2.0.

ConfigurationOfKEGGeneratorFiniteStateMachines-KjellGodo.5.mcz
KEGGeneratorFiniteStateMachinesTest-KjellGodo.3.mcz
KEGGeneratorFiniteStateMachines-KjellGodo.3.mcz
ConfigurationOfKEGGeneratorFiniteStateMachines-KjellGodo.4.mcz
KEGGeneratorFiniteStateMachinesTest-KjellGodo.2.mcz
KEGGeneratorFiniteStateMachines-KjellGodo.2.mcz
ConfigurationOfKEGGeneratorFiniteStateMachines-KjellGodo.1.mcz
KEGGeneratorFiniteStateMachinesTest-KjellGodo.1.mcz
KEGGeneratorFiniteStateMachines-KjellGodo.1.mcz