2008/11/25 Klaus D. Witzel <
klaus....@cobss.com>:
>
> On Nov 24, 8:58 pm, Igor Stasenko wrote:
>> I just uploaded a new snapshot at SqS (CorruptVM-sig.18) which
>> contains new parser code.
>>
>> Its not complete, but should work for parsing most common stuff.
>
> Checked it and it works. Good idea dissecting a copy of old Parser,
> this way one can compare source of senders and implementors ;) tested
> 'foo ^ 3 -4' to see that semantical decision of unary #- is same as in
> old Parser ;)
>
its a message send, isnt? :)
>> It having problems with hints
>> <variable: #foo knownAs: #Bar>
>>
>> if you put a message send to foo var at method's scope - hint is
>> working, but not at block scope.
>> I don't like the fix, which i currently can apply - it will put too
>> garbage between CVParser <-> CVEncoder.. need to think a better way.
>>
>> With a new parser i can track source ranges quite effectively. It is
>> because i made tokens as separate class.
>
> I think that Mathieu Suen did the same in NewCompiler for solving the
> "what does a comment belong to" issue.
>
comments belong to method source.. i don't see the need in tricks,
like capturing first comment and making something special with it -
declaring it as the method's doc or something.. It smells like
java-doc style :)
>> All tokens having source range, and its very easy to operate with
>> them, because they linked in double-linked list.
>
> Some decades ago that wouldn't have fit in 64KB and also multiplied
> the compiler's elapsed time unacceptably ;)
>
i remember i played with programmable calculator in my very youth.
It's program could contain up to 64 instructions max. And it has 6
registers or so..
But we, with friend, wrote a games on it, and learned how to hack it.
It was lot of fun.
As for the speed.. Take a look:
[
1000 timesRepeat: [CVParser new parse: '"this is a comment" foo ^ self
foo bar - 4' class: Object]] timeToRun
218
[
1000 timesRepeat: [Parser new parse: '"this is a comment" foo ^ self
foo bar - 4' class: Object]] timeToRun
252
>> There is also some tests in CVScannerTest and CVParserTest.
>
> Yes, they show green.
>
You're welcome to put code samples which you may think worth testing
with parsing.