Check out Moose and friends (Roasal, PetitParser, .. ) it may help in give shapes to your ideas; moreover most of what you describe at implementation level is already there. Hope this helps.
Without any warranties of being a good answer, Jesus 2013/1/25 mircea <[email protected]> > Here goes, > > I recently explained to someone else all of this in a rather lengthy > e-mail. I'll trim it down and post it here. It's s*till long… take your > time, maybe a cup of coffee.* > I chose the example which is not technical as it illustrates very well > what we are trying to achieve and everyone reading this can relate. On > request i can provide other examples. > > *--* > An example would be* "playing imaginary chess"* vs *"normal(real world) > chess"* vs *"a type of chess not invented yet".* > And the relationship of chess to the player. People play chess "for" > something, and that something i will describe below. > > *Imaginary chess:* > Everyone can agree that playing chess without the board and pieces in > front of you is harder that normal chess. Not only that, but everyone can > agree that having the power to imagine the chessboard and all it pieces > bears *little* importance on how well you play. > > In "Imaginary chess" you have to have two things to play 1. "the power to > imagine all the pieces on the board and the board itself" and 2. "know the > rules/conventions of chess" > > *Normal chess:* > Normal chess is "normal" since it's what you can do in the real world to > "help" everyone play chess. In normal chess this first step above is > eliminated by the "existence" of embodied things which house all the > "rules" needed to "imagine" and NOW all you have to know are 2. "the > rules/convetions" to play. We can confidently say that the popularity of > chess was helped tremendously by the creation of the chess board and pieces. > > *Type of chess not invented yet:* > How would "a type of chess not invented yet" look like. Well you have to > transfer the 2. rules and conventions of chess so they are in front of the > player. Somehow when i'm about to move a piece, for example, and i touch > it… all the possible positions that piece can go to or attack will light up. > This type of chess knows the rules "for me". Now i can come to the board > and without knowing anything, i can move and find out the rules. Eventually > i notice patterns, all the pawns move the same and so on. > > *One can say that this will not make you a good player* BUT someone who > does not know chess can *sit at this board "alone" and move pieces > around, and in time, figure out the rules*… since the board will not let > him move illegally. He does not need "training" from some other person to > play. > > SO… here we arrive at the purpose of chess, why play it? Is it 1. To gain > the power of imagining the board and pieces. OR 2. To know the > conventions/rules of the game? or 3. Be a good player. > > We can all agree the purpose is 3. Be a good player. > > When all the conventions/rules of chess can be computed for any position > of any piece on the board one can say that the *burden of knowledge of > the player has been lifted.* All he needs to do is actually play and *become > good.* The system *will let him make mistakes* but it *will not let him > make irrelevant mistakes*. > > This type of chess can be built on a computer, and some chess software "i > imagine already have this "feature"" in them. I wouldn't know i'm not a > chess fan… but it was a good example. > *--* > > > *What does this have to do with smalltalk. * > To "code" you need three things: > > 1. The power to imagine the entire system. - get this and you are at > Imaginary chess level (few people can do it) > 2. Know the rules and conventions. - get 1. and this and you are at Normal > chess level (anyone who knows how to read the rules can do it) > 3. Become good at playing. get 1. 2. and this and you are New type of > chess level… simple interactions with the system gives you feedback you are > not allowed to make irrelevant mistakes (forgetting a . at the end of a > statement, mistyping a variable name etc… all this is made impossible) > > Right now we are *ALMOST* at the level of "normal" chess. We don't have > to imagine the pieces of code, we can easily write them out on screen. I > don't have to remember hundreds of lines of code, i don't have to model > tens of objects in my head, i just write them down. Then why almost* *at > "normal chess level"? The rules and conventions of smalltalk are simple so > why not there yet. The problem is *number of types of pieces. *Chess only > has a few but a useful app has much more types of objects. > > What i, as a player, don't know, is how people before me played so far. I > go into the code for the AST for example. I have no idea and no way of > finding out what's the state "of the chess board". I would like to move, i > would like to play but without the "creator" of the pieces, even i'm know > the smalltalk rules and conventions i'm stuck *making irrelevant mistakes. > * > Also this is not chess you can't standardize the pieces BUT from our early > studies we found that patterns are more limited in number. And it is on > patterns we need to concentrate. (more on this on request, but is not > detailed here, conclusion is 90% of patterns are very simple and are > reused, most are just mutated compositions of simple patterns, 5% are > unique and really cool… la 5% are very strange) > * > * > Continuing from the example "chess" paradigm above if i want to ease my > way into things all i have to do is find how to embody this knowledge into > "stuff" that is in front of me, on screen. A couple of us here, in my > group, have done this before in other fields, and we know the steps needed. > > We deloped a way to "materializing" the patterns via the rules and > conventions smalltalk has, into things on the computer screen. This way you > get a *richer* view at your objects, one that let's your mind concentrate > on playing. > > With this i hope to get smalltak and the world "ide" to "normal chess" > level so that more people can play. > > *Right now* i am at the level of getting all the rules and conventions of > smalltalk into specially crafted visual objects on screen. * > > After this is done. This visual pattern will be like a fingerprint for a > certain method, giving instant visual feedback of what is going on inside > (is the method long or short in it's implementation… does it access a > variable… does it actually call some other… etc) > > Next level will be the development of a "weird" navigation system that > let's you "walk" through code and see lines of code (statements) as > multiple of these visual method fingerprints in one go. The uniqueness of > the visual field in front of you will give you a sense of where you are in > the code, what the code does… it's relation to other objects etc… > > > That's it… normal chess level… > Next level is about patterns and is more abstract at this point, since all > i can hope is that we have the same imagine in all of our brains, but i > can't be sure since the image in front of me is missing, so it's safer to > just build that first. > > > > > Pe 25.01.2013, la 14:34, Stéphane Ducasse [via Smalltalk] <[hidden > email]<http://user/SendEmail.jtp?type=node&node=4665354&i=0>> > a scris: > > Mircea you should explain us what you are trying to achieve. > > > On Jan 25, 2013, at 8:58 AM, Mircea Samoilă wrote: > > > This is good. So to get this "execution order" and no run-time errors... > i would need to get behind the complier and before the code actually runs. > I don't want it to bump up errors but rather just "mark" the code, in a > manner similar to code highlighting but not at the character/word level but > at language level. > > > > Mark unary, binary and keyword and have get execution pattern visible > out of this. > > > > Q1. Is there anywhere i can read more on this? How is this done? How i > would be able to > > > > Q2. You mentioned Pharo 3.0 and i can see there is a 2.0 beta… i guess > this functionality would be way off in the future? > > > > Q3. This is not a question… but a request… since it seems you know what > you are talking about, please bump me in the right direction! > > > > > > Pe 25.01.2013, la 13:39, Marcus Denker <<a > href="x-msg://180/user/SendEmail.jtp?type=node&node=4665334&i=0" > target="_top" rel="nofollow" link="external">[hidden email]> a scris: > > > >>> > >>> > >>> Question 1: Would "invalid" code compile anyway and i would get the > execution order inspecting the AST, as errors would pop up at "run time"? > >>> > >> Depending on which kind. Everything that is syntactically correct is > compiled and then run. This can lead to runtime errors, e.g. when a method > >> is called that does not exist (other languages would catch that due to > static typing at compile time). > >> > >>> Question 2: Or… invalid code does not compile and i don't get to the > stage where AST gives me anything useful (when using copy pasted code from > anywhere) so i have to code some kind of smalltalk "text" parser and search > for the patterns myself? > >>> > >> The good news is that the RBParser can compile even syntactically > incorrect code. > >> (Camillo added this): > >> > >> RBParser parseFaultyExpression: '1 +' > >> > >> Im 3.0, we will use this for syntax highlighting (instead of the > special parser now used). > >> > >> But one fun experiment would be to extend the compiler (and the AST > Interpreter) to actually > >> do the right thing: compile code for the correct part and raise an > error at runtime for the > >> RBParseErrorNode. :-) > >> > >> Marcus > > > > > > ------------------------------ > If you reply to this email, your message will be added to the discussion > below: > > http://forum.world.st/How-do-i-list-the-execution-order-of-statements-inside-a-method-tp4665303p4665334.html > To unsubscribe from How do i list the execution order of statements > inside a method?, click here. > NAML<http://forum.world.st/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> > > > > ------------------------------ > View this message in context: Re: How do i list the execution order of > statements inside a > method?<http://forum.world.st/How-do-i-list-the-execution-order-of-statements-inside-a-method-tp4665303p4665354.html> > Sent from the Pharo Smalltalk Users mailing list > archive<http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html>at > Nabble.com. >
