>
>
> 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