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 <[email protected]> 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
