Question regarding the parser(s)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Question regarding the parser(s)

Holger Hans Peter Freyther-3
Hi Paolo,

I try to come up with a test case for my parser issue and I am a bit confused
and maybe you can help me out.

1.) if I use FileStream fileIn it will end at a primitive and will always
use the internal C Smalltalk parser?!

2.) Behavior evaluate: 'Object subclass: Foo'. In the default implementation
this will be wrapped by a 'DoIt [ ^ [', code, ']]' and then executed?
Internally this will be passed to compile which should end in
VMpr_Behavior_primCompile?

Now the weird part is, that part does not appear to know about GST Syntax.

'Object subclass: Foo' does not work (this one needs a symbol)
'Object subclass: #Foo' does work
'Object subclass: #Foo []' does not work
'Object subclass: #Foo!' does work.. returns #Foo

is that a bug?

3.)
  PackageLoader fileInPackage: 'Compiler'.
  Behavior evaluate: 'Object subclass: #Foo3', returns nil and not
  Foo3 as without the Compiler.



So my question so far is:
        a) Should GST Syntax work inside the evaluate?
        b) Should the Compiler return the (last?) class it created?

as usual, thanks a lot.

_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: Question regarding the parser(s)

Paolo Bonzini-2
On 09/12/2010 07:21 PM, Holger Freyther wrote:
> Hi Paolo,
>
> I try to come up with a test case for my parser issue and I am a bit confused
> and maybe you can help me out.
>
> 1.) if I use FileStream fileIn it will end at a primitive and will always
> use the internal C Smalltalk parser?!

Unless you use "PackageLoader fileInPackage: 'Compiler'."

> 2.) Behavior evaluate: 'Object subclass: Foo'. In the default implementation
> this will be wrapped by a 'DoIt [ ^ [', code, ']]' and then executed?
> Internally this will be passed to compile which should end in
> VMpr_Behavior_primCompile?
>
> Now the weird part is, that part does not appear to know about GST Syntax.

Yes, and the fact that is wrapping your code with a method, is exactly
why it doesn't know about the GST syntax.  The GST syntax is not valid
in methods.

To parse GST syntax, you can pass a Smalltalk stream to #fileIn, like

     st> 'Object subclass: Foo []' readStream fileIn
     a ReadStream
     st> Foo
     Foo

> 3.)
>    PackageLoader fileInPackage: 'Compiler'.
>    Behavior evaluate: 'Object subclass: #Foo3', returns nil and not
>    Foo3 as without the Compiler.

That's a bug:

     st> PackageLoader fileInPackage: 'Compiler'.
     ...
     st> Behavior evaluate: '3'
     nil

I added to the issue tracker.

> b) Should the Compiler return the (last?) class it created?

Only because it's the return value of #subclass:.

Paolo

_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk