[squeak-dev] Scanner changes

Bert Freudenberg bert at freudenbergs.de
Sat Apr 2 10:10:53 UTC 2011


On 02.04.2011, at 01:56, Levente Uzonyi wrote:

> Hi,
> 
> as you probably saw, I pushed my first significant changes to the Compiler package. I hope the compiler experts will take a look at them. While I was changing stuff, I found that some methods of Scanner are unused:
> 
> #errorMultibyteCharacter
> #nextLiteral
> #checkpoint
> #revertToCheckpoint:
> 
> They seem to be rather old (~10 years) and I don't think any external code use them. Should we deprecate or just delete them?

I have no idea how the first two were used.

The checkpoint mechanism is used by DialectParser, which is part of an experiment for alternative syntax done around 2000. The class is still in the Etoys image, but is not actively unused. I'm including the class comment below.

I think it would be okay to just delete all four methods. No need for deprecation.

- Bert -

DialectParser class comment:

This Parser is part of a package designed to allow for experiments with alternatives to ST-80 syntax.  The particular alternative offered by this parser eliminates colons, left-arrows and up-arrows, and adds prefix keywords for common control constructs.

ST-80									SQ-00
-------									-------
a + b between: c and: c + 4				a + b between (c) and (c + 4)
a _ 3.0									Set a to 3.0
^ self size + 3							Return self size + 3
a > b									Test (a > b)
	ifTrue: ['greater']						ifTrue ['greater']
	ifFalse: ['less']							ifFalse ['less']
1 to: 9 do:								Repeat (1) to (9) do
	[:i | Transcript cr; show: i]				[Set i. | Transcript cr; show (i)]

The use of prefix keywords is currently ad-hoc;  in other words they are built into the parser, and there is not a way to define a method pattern to include a prefix keyword.  Most of the work has been done to support this, though, as selectors can now have the form
	#:prefix:kwd1:kwd2:
and they will respond appropriately to #keywords and #numArgs.

A test method in the class ensures that every method in the system can be pretty-printed in the alternative syntax, and that compiling the resulting text produces exactly the same bytecodes as the original method.




More information about the Squeak-dev mailing list