From: Shark8 on
On Aug 13, 2:56 am, Natacha Kerensikova <lithium...(a)gmail.com> wrote:
> On Aug 13, 1:26 am, Shark8 <onewingedsh...(a)gmail.com> wrote:
>
> > I took a bit of a stab at writing an SExpression handler, note that
> > it's not a parser [text-file -> SExpression] but rather what (I think)
> > you were terming in-memory.
>
> Indeed, that's what my idea of my still-unnamed in-memory S-expression
> object package would look like.
>
> What I find surprising is that you seem to include type information in
> the Node type (which actually represent a S-expression atom, while S-
> expression nodes usually include lists too). Is it a typical Ada way
> of doing it?
>
> I find it surprising because the underlying S-expression format (as
> standardized by Rivest, I know almost nothing about cons pairs or
> lisp) cannot encoding that information. I would expect a S-expression
> object in memory to reflect only what can be encoded to and decoded
> from S-expression files.
>
> In fact, one can consider S-expressions as a heterogeneous container,
> in that each atom can represent an object of any type (while losing
> the type information, which has to be retrieved from somewhere else),
> in contrast to thing like vectors, whose items are all of the same
> type. Does anybody know an example of heterogeneous container in Ada?
> I'm not sure how Ada generics can be leveraged in such a case.
>
> Another interesting point is that you chose arrays to represent S-
> expression lists. Your code seems currently unable to represent empty
> lists (which are legal at least in Rivest's S-expressions) but I guess
> I can't be too difficult to correct. But it raises the question of
> array vs linked list for a S-expression object implementation.
>
> I'm not sure S-expressions would ever be used in a time-critical
> application, so the usual argument of cache-friendliness of arrays is
> pretty weak here. S-expressions are meant to be used for I/O where the
> bottleneck is most likely to be.
>
> Ada arrays are statically sized, which can be an issue for parsing,
> because S-expression format doesn't encode list length, so a list has
> to be built by pushing nodes one after the other until encountering
> the end-of-list marker. But I think that should be easily worked
> around by using vectors for unfinished S-expression lists, and once
> the list is completely parsed build the array from the vector, and
> reset the vector for further list parsing.
>
> However for S-expression objects dynamically created into memory, the
> static size of arrays might make some operations much less efficient
> than with linked lists.
>
> Any idea I'm missing about this implementation choice? Would it be
> worth to try and make such a package generic over the container type
> (array vs linked list vs something else?)?
>
> Thanks for your code example,
> Natacha

From: Jeffrey Carter on
On 08/13/2010 02:10 AM, Natacha Kerensikova wrote:
> On Aug 13, 12:25 am, "Jeffrey R. Carter"
> <spam.jrcarter....(a)spam.acm.org> wrote:
>> Kerensikova (or is it ?)
>
> It's both ;-) One of them is my real-life last name, as can be found
> on my ID or on copyright notices, while the other is a pseudonymous
> last name I've been using over the internet for something like a
> decade now. While it was never intended to more than a thin pseudonym,
> it was supposed to require a little more research to make the
> connection, here I just messed up with Google accounts (I really hate
> these browser interfaces, and now it makes me hate them even more, I
> wish I could find a NNTP server and a real user-friendly text-mode
> news reader).

Interesting. IIUC, "-ova" is a Bulgarian feminine patronymic suffix. Port�
appears to be French ("carried"). "Natacha" might also be the French
transliteration of what is usually transliterated in English as "Natasha".

I don't know about a text-mode news reader, but you can point a news reader at
freenews.netfront.net without registering.

I seem to be getting seriously OT.

>> provided a more detailed grammar (using the
>> trailing '*' from regexps rather than {}) with some additional options.
>
> Is one of them more standard than the other? While I'm very familiar
> with regex, I only have a few theoretical notions about grammar, and
> almost nothing as practical experience with real grammar formats.

Both seem to be standards. {} is used in the ARM, Annex P, with its standard
meaning of "zero or more", which is why I used it, and am surprised Brenta
didn't understand it.

> I can assure you what I'm doing is completely conform with Rivest's
> standard proposition. I don't know how come it has not reached the
> status of full-fledged RFC (while real RFCs like SPKI do depend on
> it), but I'm using it as if it had. I only dropped the "display hint"
> stuff from the format, because I find it little to no use, while it
> introduces quite a bit of complexity.

Yes, things are murkier than I realized. S-expressions seem to have originated
with Lisp, long before Rivest's proposal, but the cons-pair is an implementation
detail, not an inherent part of the syntax, so lists can have zero or more elements.

--
Jeff Carter
"C++ is like giving an AK-47 to a monk, shooting him
full of crack and letting him loose in a mall and
expecting him to balance your checking account
'when he has the time.'"
Drew Olbrich
52

--- news://freenews.netfront.net/ - complaints: news(a)netfront.net ---
From: Simon Wright on
Natacha Kerensikova <lithiumcat(a)gmail.com> writes:

> (I really hate these browser interfaces, and now it makes me hate them
> even more, I wish I could find a NNTP server and a real user-friendly
> text-mode news reader).

news.eternal-september.org, and emacs.
From: Dmitry A. Kazakov on
On Fri, 13 Aug 2010 12:23:38 -0700, Jeffrey Carter wrote:

> Interesting. IIUC, "-ova" is a Bulgarian feminine patronymic suffix.

in all Slavic languages, actually.

> "Natacha" might also be the French
> transliteration of what is usually transliterated in English as "Natasha".

Natasha is Russian's diminutive of Natalia.

Compare Sasha-Alexander, Masha-Maria, Pasha-Paul, Grisha-Gregory,
Misha-Michael and so on.

--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
From: Yannick Duchêne (Hibou57) on
Le Fri, 13 Aug 2010 21:23:38 +0200, Jeffrey Carter
<spam.jrcarter.not(a)spam.not.acm.org> a écrit:
> Porté appears to be French ("carried").
Right
> "Natacha" might also be the French transliteration of what is usually
> transliterated in English as "Natasha".
Right too

> I don't know about a text-mode news reader, but you can point a news
> reader at freenews.netfront.net without registering.
I did not knew this one. However, I could also suggest the one I known :
nntp.aioe.org/ (or to visit http://www.aioe.org/ )


--
There is even better than a pragma Assert: a SPARK --# check.
--# check C and WhoKnowWhat and YouKnowWho;
--# assert Ada;
-- i.e. forget about previous premises which leads to conclusion
-- and start with new conclusion as premise.
First  |  Prev  |  Next  |  Last
Pages: 22 23 24 25 26 27 28 29 30 31 32 33
Prev: GPRbuild compatibility
Next: Irony?