help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-smalltalk] [PATCH] stinst: Fix the scanner for compile time co


From: Holger Hans Peter Freyther
Subject: Re: [Help-smalltalk] [PATCH] stinst: Fix the scanner for compile time constants in literal arrays
Date: Sat, 21 Dec 2013 18:50:15 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

On Sat, Dec 21, 2013 at 06:14:02PM +0100, Holger Hans Peter Freyther wrote:

> The scanner didn't tokenize ##(1/2)) correctly. After scanning the
> last $) has not been processed yet. Count the number of optimized
> tokens and consume an equal amount of $). >>#scanLiteralArrayParts
> will only parse the $) when there is an unclosed compile time
> constant.

Okay, now it is question of getting the code compiled by STCompiler.

  STInST.RBParser parseExpression: #(##(1/2) 1)

will create a:

  RBLiteralNode
    token: RBLiteralToken(
                RBOptimizedToken RBNumberLiteralToken(1) RBLiteralToken(#/)
                RBNumberLiteralToken(2) RBSpecialCharacterToken($)
                RBNumberLiteralToken(1))

this means that the RBOptimizedNode is not created and not visited.
So RBLiteralNode>>#value will call token realValue. We have some problems
one way or another...

if we compress RBOptimizedToken ... to a RBOptimizedNode we would
mix tokens and AST nodes.

if we add realValue to RBOptimizedToken we re-do things the compiler
is doing?

What about creating a RBArrayLiteralNode that has a list RBLiteralNode?
At the same time the RBOptimizedToken and things will be formatted
as #{} thing.

Another thought would be to solve the compile time constants somehow
else? E.g. do we really need code like this:

  #(##(| a | a := -2. 'before everything' printNl. a) 3)



holger



reply via email to

[Prev in Thread] Current Thread [Next in Thread]