Maybe not what you are looking for, but you might find http://awelon.org/ interesting.
BR, John 2012/3/19 Benoît Fleury <benoit.fle...@gmail.com>: > Hi, > > I was wondering if there is any language out there that lets you describe > the behavior of an "object" as a grammar. > > An object would receive a stream of events. The rules of the grammar > describe the sequence of events the object can respond to. The "semantic > actions" inside these rules can change the internal state of the object or > emit other events. > > We don't want the objects to send message to each other. A bus-like > structure would collect events and dispatch them to all interested objects. > To avoid pushing an event to all objects, the "bus" would ask first to all > objects what kind of event they're waiting for. These events are the > possible alternatives in the object's grammar based on the current internal > state of the object. > > It's different from object-oriented programming since objects don't talk > directly to each other. > > A few questions the come up when thinking about this: > - do we want backtracking? probably not, if the semantic actions are > different, it might be awkward or impossible to undo them. If the semantic > actions are the same in the grammar, we might want to do some factoring to > remove repeated semantic actions. > - how to represent time? Do all objects need to share the same clock? Do we > have to send "tick" events to all objects? > - should we allow the parallel execution of multiple scenarios for the same > object? What does it make more complex in the design of the object's > behavior? What does it make simpler? > > If we assume an object receive a tick event to represent time, and using a > syntax similar to ometa, we could write a simplistic behavior of an ant this > way: > > # the ant find food when there is a food event raised and the ant's position > is in the area of the food > # food indicates an event of type "food", the question mark starts a > semantic predicate > findFood = food ?(this.position.inRect(food.area)) > > # similar rule to find the nest > findNest = nest ?(this.position.inRect(nest.area)) > > # at every step, the ant move > move = tick (=> move 1 unit in current direction (or pick random > direction if no direction)) > > # the gatherFood scenario can then be described as finding food then finding > the nest > gatherFood = findFood (=> pick up food, change direction to nest) > findNest (=> drop food, change direction to food source) > > There is probably a lot of thing missing and not thought through. > > But I was just wondering if you know a language to do this kind of things? > > Thanks, > Benoit. > > _______________________________________________ > fonc mailing list > fonc@vpri.org > http://vpri.org/mailman/listinfo/fonc > _______________________________________________ fonc mailing list fonc@vpri.org http://vpri.org/mailman/listinfo/fonc