Giter VIP home page Giter VIP logo

Comments (5)

mflatt avatar mflatt commented on June 12, 2024 1

The last time I looked into this, I concluded that it was due to an ambiguity in the grammar, where algol60 chooses a different parse than the example intends. I don't remember how I arrived at that conclusion, though.

from algol60.

LiberalArtist avatar LiberalArtist commented on June 12, 2024

Hm, well, it does that when it's a DrRacket language. With #lang algol60, it compiles, but running it produces a different error, bad value: expected a number, got #<undefined>. DrRacket helpfully draws some arrows explaining the source of the error:

Screenshot of DrRacket

from algol60.

samth avatar samth commented on June 12, 2024

Testing the #lang algol60 version, it has failed that way at least since Racket 6.5.

from algol60.

bg-hub2 avatar bg-hub2 commented on June 12, 2024

You may wish to slightly modify the man-or-boy example to get it work with Racket Algol 60. The following works for me:

#lang algol60
begin
  comment
    *  Man or Boy
    *  A well-known example program, written by D. Knuth
    *  The expected value to be printed is  -67.0
    ;
  real procedure A(k, x1, x2, x3, x4, x5);
    value k; integer k;
    real x1, x2, x3, x4, x5;
  begin
    real procedure B (arg);
      Boolean arg;
    begin k := k - 1;
          B := A := A(k, B(true), x1, x2, x3, x4)
    end;
    if k <= 0 then A := x4 + x5 else  B(true)
  end;
  printnln(A(10, 1, -1, -1, 1, 0))
end

The point is that Racket seemingly fails to call the parameterless function B. In the code shown above I introduced a dummy parameter to enforce the function call.

from algol60.

soegaard avatar soegaard commented on June 12, 2024

Since the "Man or boy test" is meant to test Algol implementation, it feels like cheating modifying it.

https://en.wikipedia.org/wiki/Man_or_boy_test


The man or boy test was proposed by computer scientist Donald Knuth as a means of evaluating implementations of the ALGOL 60 programming language. The aim of the test was to distinguish compilers that correctly implemented "recursion and non-local references" from those that did not.[1]

There are quite a few ALGOL60 translators in existence which have been designed to handle recursion and non-local references properly, and I thought perhaps a little test-program may be of value. Hence I have written the following simple routine, which may separate the man-compilers from the boy-compilers.

— Donald Knuth[2]

from algol60.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.