[Aldor-l] [Aldor-combinat-devel] Should this "parser" work?
Christian Aistleitner
tmgisi at gmx.at
Sat Oct 28 10:02:54 EDT 2006
Hello,
On Thu, 26 Oct 2006 23:33:47 +0200, Martin Rubey
<martin.rubey at univie.ac.at> wrote:
> The AUG says about an expression T in
>
> C == T add { ... }, i.e., an expression in "type context":
>
> Type context is special in two ways:
> * Expressions occurring in type context are not guaranteed to be
> evaluated
> in any particular order, or even evaluated at all.
>
> * Identifiers occurring in an expression, T, appearing in type
> context must
> be constant in the scope in which T occurs.
> The reason expressions in type context are not guaranteed to be
> evaluated in
> order, or at all, is to give maximum flexibility to produce efficient
> programs. A portable program will only use non-side-effecting
> expressions in
> type context.
>
> In the present case of the "grammar" function, I guess that the second
> "speciality" -- name constancy -- is satisfied. In our case, T is
> evaluate(parse(p.i), res). Am I right that "the scope in which T
> occurs" is
> simply "evaluate(parse(p.i), res)" itself? Or is it the whole body of E?
I tend to read things differently.
I agree that T is “evaluate(parse(p.i), res)”. However, I'd interprete
“scope” in a wider sense. Namely “everywhere you use T”. And you
indirectly use T quite a lot. Especially, you return it as element of a
List when exiting from grammar.
But I am far from convinced that I am right here.
However, from my feeling the kind of “being constant” I just described, is
what I deem necessary.
> In any
> case, I'd argue that "res" is not modified, only it's individual
> elements are.
You use
res.i := something
. That is just an abbreviation for
set!( res, i, something )
. And note the exclamation mark. To me, changing part of a thing alters
the thing.
> PS: Christian, you also wrote
>
>> To me, it fits well into my picture of Aldor. But I am not sure if
>> that's
>> good for your Aldor-Combinat project.
>
>> Nevertheless, it's good to see your code working. It's also fine, what
>> you
>> demonstrated with all the debug output in the form of (Something pretend
>> MachineInteger).
>
> I don't really understand: you say that it's good that my code is
> working, and
> that it first well into your picture of Aldor. Isn't that a little
> contradictory to your second sentence?
I do not think it's contradictory.
It's good to see working code. Especially for the Aldor-Combinat project,
the grammar parsing stuff is a really nice thing to have. I like that.
It's a solution that's currently working.
But I'd not consider it a bullet proof solution. I would not rely on your
code working in future compilers.
Nevertheless, its better to have fragile code than to have no code at all.
From my perspective, there is no bullet proof solution.
And that's the bad thing for the Aldor-Combinat project.
However, there is an implementation. And your implementation is as robust
as possible -- at least with the current tools we have.
--
Kind regards,
Christian
More information about the Aldor-l
mailing list