This fixes one of the blockers for the release. Basically:
- CompiledMethods remembers if they were old or new syntax
- #compile: only accepts methods with the new syntax
- #recompile is added to CompiledMethod
- a new #methodFormattedSourceString method was added which
is used to
recompile old-syntax methods (and is only provided when
Parser is
loaded, so old-syntax methods can only be recompiled if
Parser is loaded)
- the C and STInST parsers was adapted to mark old-syntax
methods
appropriately
- #parserClass was moved from Behavior to CompiledMethod.
While it is
all fine that different Behaviors have different Compilers,
if we want
any tool to reason on the source code it *must* be standard
Smalltalk
syntax. Stephen's recent Presource examples show how far
you can go
while remaining within those boundaries. Even parsing could
be done
using a syntax like this:
term [
<parse: #rule>
factor save, ((#+ | #-) save, factor save) sequence
-> [ :op1 :ops |
ops inject: op1 into: [ :result :op |
result perform: op first with: op second ].
]
factor [
<parse: #rule>
primary save,
((#* | (#/ -> #//) save, primary save) sequence
-> [ :op1 :ops |
ops inject: op1 into: [ :result :op |
result perform: op first with: op second ].
]
primary [
<parse: #rule>
number save
| #'(', term save, #')'
-> [ :value | value ].
identifier
-> [ :name | vars at: name ].
]
Needs more testing, but unless someone screams that they
don't like it
and suggest a better way, this will be committed.
Paolo
_______________________________________________
help-smalltalk mailing list
help-smalltalk gnu.org
http://lists.gnu.org/mailman/listinfo/help-smalltalk
|