New parser uploaded

1 view
Skip to first unread message

Igor Stasenko

unread,
Nov 24, 2008, 2:58:14 PM11/24/08
to Moebius project discussion
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.

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.
All tokens having source range, and its very easy to operate with
them, because they linked in double-linked list.

There is also some tests in CVScannerTest and CVParserTest.

--
Best regards,
Igor Stasenko AKA sig.

Klaus D. Witzel

unread,
Nov 25, 2008, 3:22:40 AM11/25/08
to Moebius project discussion
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 ;)

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

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

> There is also some tests in CVScannerTest and CVParserTest.

Yes, they show green.

Igor Stasenko

unread,
Nov 25, 2008, 3:58:30 AM11/25/08
to moebius-proje...@googlegroups.com
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.
Reply all
Reply to author
Forward
0 new messages