[TUHS] Unix stories, Stephen Bourne and IF-FI in C code

Adam Sampson ats at offog.org
Mon Jan 9 09:14:17 AEST 2017


"Walter F.J. Mueller" <w.f.j.mueller at retro11.de> writes:

> [...] to enjoy C with an Algol-look.

For those who enjoy Bournegol, can I also recommend the source code to
David Turner's KRC, which was ported from (EMAS) BCPL to C using a
similar approach. A sample from main.c:

STATIC VOID
DISPLAYCOM()
{  TEST HAVEID()
   THEN TEST HAVE(EOL)
        THEN DISPLAY(THE_ID,TRUE,FALSE); OR
        TEST HAVE((TOKEN)DOTDOT_SY)
        THEN {  ATOM A = THE_ID; LIST X=NIL;
                ATOM B = HAVE(EOL) ? (ATOM)EOL :>       // BUG?
                        HAVEID() && HAVE(EOL) ? THE_ID :
                        0;
                TEST B==0 THEN SYNTAX();
                OR X=EXTRACT(A,B);
                UNTIL X==NIL
                DO {  DISPLAY((ATOM)HD(X),FALSE,FALSE);
                      X=TL(X);  }  } //could insert extra line here between groups 
        OR SYNTAX();
   OR SYNTAX();
}  

http://krc-lang.org/

-- 
Adam Sampson <ats at offog.org>                         <http://offog.org/>


More information about the TUHS mailing list