VAST cannot compile method named: ::=

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

VAST cannot compile method named: ::=

jtuchel
Hi there,

I guess I'm asking for things that were far out of scope of VisualAge
back in 1996 (which is the date when EsParser>>nextToken was last
changed).

Since I was very fascinated by Lukas Renggli's PetitParser at ESUG
2010, I was hoping for a port to show up. In fact, Sebastian tried it
and sent me his results, but he had trouble porting some of the
methods, one of which is named ::= . VA does not compile a method
named ::= It will just say: message pattern expected when you try to
save the new method.

With "normal" Smalltalk tools, it is hard to debug what's going on
here because the system is quite likely to be very busy with
itself ;-), but I could at least track it down to EsParser>>nexToken
where it will not accept anything but #COLON, #COLONEQUAL or
#COLONCOLON. Other methods starting with a colon will simply be
rejected with a syntax error (at least that is what I understand from
the code). I think it should end up being a #BINARYSELECTOR from what
I can judge after a short time looking into this.

I haven't taken the time to look into the ANSI standard, but the fact
that it seems possible to implement ::= in Squeak and Pharo (where
PetitParser runs) seems to be enough argument for changes to that
behaviour.
Tools like PetitParser demonstrate some of the strengths of Smalltalks
and therefor it would be great if it could be ported to our dialect
without strange method renames.

Or am I completely missing the point and there are real problems why a
method like ::= is not possible in VAST?

Joachim

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/va-smalltalk?hl=en.

Reply | Threaded
Open this post in threaded view
|

Re: VAST cannot compile method named: ::=

John O'Keefe-3
Joachim -

A colon (:) is not one of the ANSI Smalltalk binaryCharacters defined for use in binarySelectors (Section 3.5.5).  However, ANSI Smalltalk leaves implementors an out by saying "An implementation may define additional binaryCharacters but their use may result in a nonportable program."

Right now colons get special treatment as you can see in EsScanner>>nextToken.  They are not expected to appear outside the context of assignment (#COLONEQUAL), namespace separator (#COLONCOLON), keywordSelector (#KEYWORD), or ??? (#COLON).  

If I were experimenting, I would:
  1. Figure out what happens to #COLON tokens
  2. Update the ByteArray used to look for possible characters in a #BINARYSELECTOR by turning on the correct bit for colon (':')
I took a quick look at the RBScanner and it would have a couple problems with '::=':
  1. It only supports 1 and 2 character binary selectors
  2. It also treats colon as a special syntactical character, so it probably wouldn't parse '::=' as you want it to even if it did support 3 character binary selectors
Maybe this gives you enough to be able to hack a solution -- I don't have time to add much more to this discussion right now.

John

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/va-smalltalk?hl=en.
Reply | Threaded
Open this post in threaded view
|

Aw: Re: VAST cannot compile method named: ::=

jtuchel
John,

thanks a lot for looking into it and commenting.

So what we really should do is convince Lukas to change his implementation of PetitParser, because selectors like "::=" are in a grey area of the Smalltalk ANSI standard. The side effects of changing EsParser are probably too much of a risk, especially if there is also an RB scanner and possibly more tools that might break.

So let's see if we can change PetitParser...

Joachim

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/va-smalltalk?hl=en.
Reply | Threaded
Open this post in threaded view
|

Aw: Re: VAST cannot compile method named: ::=

jtuchel
Hi, me again!

since there also are problems with selectors like ==> and >=>, and these also occur in GNU Smalltalk, we should probably indeed try and convince the Moose team and/or Lukas to change PetitParser and choose selectors that comply with the ANSI standard...

Joachim


--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/va-smalltalk?hl=en.