[self-interest] oldParser. using ?
Marko Mikulicic
marko at seul.org
Mon Oct 15 13:11:50 UTC 2001
Jecel Assumpcao Jr wrote:
>On Sunday 14 October 2001 14:22, Marko Mikulicic wrote:
>
>>But I still don't know how to flatten the nested annotations. How can
>>I read the raw annotation string
>>(is there a primitive ?) to lear by examples ?
>>
>
>It is great that you are fixing this... it always seemed a little sad
>to have such a broken example in the system.
>
I made some hacks to implement resend but I have added categorization
so now the code is more readable. The parser is surprisingly elegant and
simple and it
would be a good example of the power of self (although it doesn't use
many self-related features; it could
in fact been rewritten in smalltalk without too many problems, but in
self looks more elegant).
The parser builds only the parse tree. A bytecode generator would
>
>
>I hadn't noticed that the mirror primitives worked with special
>annotation objects instead of strings.
>
They use strings, but they separate object annotations from slot
annotations.
If I understood well the annotation mechanism, the parser takes the
nested annotations and flattens
it in a string which is stored in the object's map. I want to know how
it stores the relationship
between the slot annotation part and the collection of slot names it
references. For example:
(| {} = 'Comment: cmt' slot1 . {'Comment: slot comment' slot2. slot3} .
slot4|)
this object will have an object comment, and the slots slot2 and slot3
will have the same comment ('slot comment').
When i send asMirror annotation to this object I get only 'Comment:
cmt'. Where are the other comments stored ?
I know that I can access the slot annotations trough slot reflection,
but I want to know how this is stored in the object annotation (I only
readed that objects have annotation. slots doesn't seem to directly have
annotations). Wich separator
is used ? if you use 16r7f then how the can the framework-level
annotation groups (ModuleInfo;, Comment: ...) been distinguished from
the flattening of nested annotations ?
At least I want to know if the annotations are really strings and if
they are really stored in the object, and not in a per slot fashon.
>
>
>This seems to work:
>
> ((reflect: shell) _MirrorCopyAnnotation: 'Comment: hello') reflectee
>
>I couldn't find the actual annotation parsing code in a quick look
>through the VM. My initial impression is that the strings for nested
>annotations are simply concatenated (with the proper separator, of
>course), but it would be interesting to do some experiments to confirm
>this.
>
>
>
>Are you aware of the Mango parser generator? Mario used it to generate
>the parser for Smalltalk and I wrote most of a Self grammar for it (I
>am not sure it is possible to finish it, however, and I have mentioned
>this a few times on this list already):
>
Yes I know about Mango and but I heard that the Self syntax is not
well suited for parser generators (not LAR or whatever is called).
I remember you have said that you started but I also remember you said
that you don't remember why you didn't finish it, probably because the
grammar was ambiguos
(I think expecially the keyworded send and the resend with the obuse of
dot notation. perhaps annotations
also bring some problem; the progref says the grammar of annotations is
ambiguos).
Also I don't know how big the resulting parser will be and witch parts
of the framework it will use.
For a bootstrapping a handcrafted parser is better suited, I think.
Also, I don't know how better is Mango than bison but maybe there is a
reasion why the parser in the VM was handcrafted and not generated.
If I finish that parser it would be nice to try to make the VM switch to
it for evaluating code from its primitives.
The hardcoded parser will be certainly better in error handling for now
but I think it would be great if more code migrates to Self from the
VM. I don't want to Squeakize Self but at least the parser....
Marko
More information about the Self-interest
mailing list