[Newcompiler] [ANN] First version of Shout using new SqueakParser/SqueakScanner

Mathieu Suen mathieusuen at yahoo.fr
Sun Aug 27 14:49:53 UTC 2006


Andrew Tween a écrit :
> Hi everyone,
> I have put together an experimental version of Shout which uses subclasses of
> SqueakParser/SqueakScanner. You can get it from here...
> 
> http://www.squeaksource.com/shout/ShoutUsingNewCompiler.3.15-tween.71.mcz
> 
> It have developed/tested it in the NewCompiler.image.

Good!

> 
> Currently, the subclasses have their own SmaCC definitions, but it would be good
> to merge the changed definiiton into the main parser/scanner. Who is the best
> person to talk to about that?
> 
> When I tried making changes to the SqueakParser and regenerating it, I got a lot
> of errors from which I couldn't recover. It's obvious why -  I was compiling the
> SqueakParser with a compiler which uses the SqueakParser. Half way through
> compilation the SqueakParser is in an invalid state).
>     I got around this by using the old compiler to compile SqueakParser/
> scanner, but it raises the question - "if an image only contained the new
> compiler, then how could the parser be maintained?". How would this be handled -
> include the old compiler, modify the Smacc generator to compile to a temporary
> class and then rename it, have 2 Smacc parsers and alternate between them, ...?
> Of course, by subclassing SqueakParser/scanner I circumvented the problem
> altogether.

You can use Preferences compileUseNewCompiler this could solve some
problems like in:

rangesIn: aText setWorkspace: aBoolean
	"Answer a collection of SHRanges by parsing aText.
	When formatting it is not necessary to set the workspace, and this can
make the parse take less time, so aBoolean specifies whether the parser
should be given the workspace"

	parser ifNil: [parser := Preferences compileUseNewCompiler
											ifTrue:[SqueakParser new]
											ifFalse: [SHParserST80 new]].
	^parser
		rangesIn: aText asString
		classOrMetaClass: classOrMetaClass
		workspace: (aBoolean ifTrue:[workspace])
		environment: environment

But I think you are right we must provide a way to have 2
parser/compiler/... One for developemnt and the other for production in
the same image.

We can find a way to copy the stuff in developement to production and
rename the class but I don't know.

> 
> Cheers,
> Andy
> 
> 

I have some question How do you managed to get the comments?
I saw that you add one token per comment but I don't know when you use it.

Thanks
Math
-------------- next part --------------
'From Squeak3.9gamma of ''23 July 2006'' [latest update: #7051] on 27 August 2006 at 4:39:33 pm'!

!SHTextStylerST80 methodsFor: 'private' stamp: 'ms 8/27/2006 16:39'!
rangesIn: aText setWorkspace: aBoolean
	"Answer a collection of SHRanges by parsing aText.
	When formatting it is not necessary to set the workspace, and this can make the parse take less time, so aBoolean specifies whether the parser should be given the workspace"

	parser ifNil: [parser := Preferences compileUseNewCompiler 
											ifTrue:[SqueakParser new] 
											ifFalse: [SHParserST80 new]].
	^parser 
		rangesIn: aText asString 
		classOrMetaClass: classOrMetaClass 
		workspace: (aBoolean ifTrue:[workspace])  
		environment: environment
! !


More information about the Newcompiler mailing list