vim syntax gel?

From: Squeak <>
Date: Fri, 4 Jun 1999 04:28:42 -0400 (EDT)

I read on the web site about a vim syntax for gel files, I'd be interested
in the link. I couldn't find it.

And of course a crash bug:

I was playing with recursive functions and found a sort of platform
dependent problem. Highly recursive functions don't really work.

The stack trace shows that the stack (on linux-x86) which started just under
0x08060000 had grown below 0x08050000. In this compilation, directly below
0x08050000 is the text segment of the program (the code). So the stack
tried to overwrite the main code of the program. A Segment Violation ensued.

This is caused by the evaluator calling itself recursively, and I
don't see a real solution that doesn't involve alot of redesign.
However you did say "any segfault in genius is a bug" and here
is one.

Kludge fix: don't allow more than say 200,000 levels of recursion. Have
eval_node or whatever function have a static variable called depth,

generic_recursive_function(int arg,...) {
        static depth=0;
                return do_error_recursion();
        ... main body ...
        return retval;

increment at start, decrement at end, throw an exception if it is bigger
than some large number, blah blah.

Here is the gel code that came up with the error:

        function factor(a) = ( function _factor(a,i) = if(a>=i*i)
        then if (a%i) then _factor(a,i+1+(i!=2)) else [ i ,
        _factor(a/i,2)] else [a] ; _factor(a,2));

        function Q(a,b,c) = if a then b else c

        function factor2(a) = ( function _factor(a, i) = Q(a>=i*i,
        Q(a%i, _factor(a, i+1+(i!=2)), [i, _factor(a/i,2)]),[a])
        ; _factor(a,2));

        function gcd(a,b) = Q(a%b,gcd(b,a%b),b);

factor(2^51-1) will segfault sometimes. Sometimes it gives the
right answer very quickly.

factor2(4) segfaults it. I think there is a parser error on that,
but I might have just made a mistake, that vim syntax file sure
would be great *grin*

BTW I don't consider these recursive functions monstrosities or
pathological cases. They are simply solutions to problems that
do not make use of re-assignment. I'm vaguely trying to write a
language without re-assignment, and have found all problems to
be formaly solvable. However this points out a problem with my
recursive solutions. If someone knows a compiler/interpretter that
won't choke on these things let me know. Or if you know a solution
that doesn't use re-assignment or recursion, I would love to hear it.

Work progresses nicely on the gmp-wrappers. I should actually have
some code you can use soon.

Received on Fri Jun 04 1999 - 01:01:22 CDT

This archive was generated by hypermail 2.2.0 : Sun Apr 17 2011 - 21:00:02 CDT