Thanks's Marcus. It is beautiful thing.

Is parsing locate errors by "dot"s? I mean how it will parse "3+. 1+2"? It will be super cool if we have only "3+." as error but remains code as good one

Best regards,
Denis

2015-05-13 9:35 GMT+03:00 Marcus Denker <marcus.denker@inria.fr>:
We can parse code with syntax errors: it generates partial ASTs with the faulty part of the input as a RBParseErrorNode.

Only three methods are needed to allow generating executable methods from such an AST: the SyntaxErrorNotification
��is raised at runtime instead of compile time.

testEvalSimpleMethodWithError
�� �� | ast cm |
�� �� ast := OpalCompiler new
�� �� �� �� �� �� �� �� source: 'method 3+';
�� �� �� �� �� �� �� �� useFaultyForParsing: true;
�� �� �� �� �� �� �� �� parse.

�� �� self assert: ast isMethod.
�� �� self assert: ast isFaulty.

�� �� cm := ast compiledMethod.
�� �� self should: [cm valueWithReceiver: nil arguments: #()] raise: SyntaxErrorNotification

The syntax error instance is compiled in via a literal variable, in the end the only thing needed was:

visitParseErrorNode: anErrorNode
�� �� �� �� methodBuilder
�� �� �� �� �� �� �� �� pushLiteralVariable: #error -> anErrorNode asSyntaxErrorNotification;
�� �� �� �� �� �� �� �� send: #signal.

This is in #50044.

Future work: introduce a RuntimeSyntaxError that can be turned off per error and globally.

�� �� �� �� Marcus