[comp.lang.misc] Is this Pascal?

rwi@naucse.UUCP (Robert Wier) (10/01/88)

 I recently downloaded a 68,000 assembler from the Motorola Freeware
 board.  It looks somewhat like Pascal, but if it is, it is a very
 strange variant.  It may be CPM oriented.  Can you tell me 1) is this
 Pascal? and 2) What are the syntax rules for matching the END statements
 with the conditionals?

 --Thanks -- Bob Wier  !arizona\!naucse\!rwi

PROCEDURE LongSub (A, B : LONG;VAR Result : LONG);
    (* Subtract two LONGs (A - B), giving Result *)

	VAR
		Borrow : INTEGER;
		i : CARDINAL;

BEGIN
	Borrow := 0;
	FOR i := 1 TO DIGITS DO
		Result[i] := (A[i] - Borrow) - B[i];
	IF Result[i] < 0 THEN
		Result[i] := Result[i] + BASE;
	Borrow := 1;
	else
		Borrow := 0;
END;
END;
END
LongSub;

randy@qiclab.UUCP (Randy Bush) (10/03/88)

No, it's Modula-2, and might be formatted to look something like:

PROCEDURE LongSub (A, B : LONG;VAR Result : LONG);
    (* Subtract two LONGs (A - B), giving Result *)

VAR
    Borrow : INTEGER;
    i      : CARDINAL;

BEGIN
    Borrow := 0;
    FOR i := 1 TO DIGITS DO
        Result[i] := (A[i] - Borrow) - B[i];
        IF Result[i] < 0 THEN
            Result[i] := Result[i] + BASE;
            Borrow := 1
        ELSE
            Borrow := 0
            END
        END
    END LongSub;
-- 
..!qiclab!randy or ..!qiclab!m2xenix!randy              voice +1 (503) 245-2202
{..!mcvax!uunet,..!tektronix,..!sun!nosun}!oresoft!randy  BBS +1 (503) 297-8820
also ..!oresoft!m2xenix!randy  also  randy@dawggon.fidonet.org  FidoNet 1:105/6

greggy@infmx.UUCP (greg yachuk) (10/04/88)

In article <942@naucse.UUCP> rwi@naucse.UUCP (Robert Wier) writes:
> strange variant.  It may be CPM oriented.  Can you tell me 1) is this
> Pascal? and 2) What are the syntax rules for matching the END statements
> with the conditionals?
>
> --Thanks -- Bob Wier  !arizona\!naucse\!rwi

It looks like each control statement can have a statement list and must
be explicitly END'ed.  Somewhat-more-standard Pascal's usually take allow
a single statement (which may be BEGIN stmt-list END).  I'd line them up
like this:

PROCEDURE LongSub (A, B : LONG;VAR Result : LONG);
    (* Subtract two LONGs (A - B), giving Result *)
VAR Borrow : INTEGER;
    i : CARDINAL;

BEGIN
	Borrow := 0;
	FOR i := 1 TO DIGITS DO
		Result[i] := (A[i] - Borrow) - B[i];
		IF Result[i] < 0 THEN
			Result[i] := Result[i] + BASE;
			Borrow := 1;
		else
			Borrow := 0;
		END;
	END;
END LongSub;

Greg Yachuk		Informix Software Inc., Menlo Park, CA	(415) 322-4100
{uunet,pyramid}!infmx!greggy		why yes, I DID choose that login myself

torsten@pcsbst.UUCP (Torsten Homeyer) (10/05/88)

In article <942@naucse.UUCP> rwi@naucse.UUCP (Robert Wier) writes:
>
>
> I recently downloaded a 68,000 assembler from the Motorola Freeware
> board.  It looks somewhat like Pascal, but if it is, it is a very
> strange variant.  It may be CPM oriented.  Can you tell me 1) is this
> Pascal? and 2) What are the syntax rules for matching the END statements
> with the conditionals?

	1) Looks like Modula-2 or some derivat.
	2) ????
		
		Torsten.
---
Name    : Torsten Homeyer         {tho@pcsbst ; torsten@homeyer}.UUCP
Company : PCS GmbH, Munich W-Germany.
UUCP  : ..uunet!unido!pcsbst!tho     ..uunet!unido!pcsbst!sws4!torsten
PRIVAT: ..unido!{pcsbst,megalon,mikros,[altger,netmbx]!oldman}!homeyer!torsten

mfox@hpbsla.HP.COM (Martin_Fox) (10/06/88)

Looks like Modula-2 to me.  Tip-offs include the use of the CARDINAL type,
which is used for unsigned integers, the lack of BEGIN's, and the inclusion
of the procedure name at the end of the declaration.

Modula-2 is a nifty language defined by Wirth to clean up some of the problems
of Pascal, providing clearer syntax, low level facilities, type coercion, etc.
I suggest you find a copy of Wirth's book on the language (I cannot remember
who publishes it).  It is very similar to Pascal, just a step up.  However,
Modula programs cannot be compiled with Pascal compilers, due to syntax
differences.

Groups of statements do not, in general, need to be bracketed in Modula, as
every control structure assumes a list of statements follows.  In other words,
the syntax for a FOR loop is

	FOR variable := start TO stop DO
		statement1 ;
		statement2 ;
		etc. ;
	END (* FOR *) ;

For an IF statement, the syntax is

	IF expression THEN
		statement1 ;
		statement2 ;
		etc. ;
	ELSE
		statement ;
		statement ;
	END (* IF *) ;

The code you showed looked badly formatted and improperly indented.

bbw842@leah.Albany.Edu (Barry B Werger) (10/11/88)

In article <653@pcsbst.UUCP>, torsten@pcsbst.UUCP (Torsten Homeyer) writes:
> In article <942@naucse.UUCP> rwi@naucse.UUCP (Robert Wier) writes:
> >
> >
> > I recently downloaded a 68,000 assembler from the Motorola Freeware
> > board.  It looks somewhat like Pascal, but if it is, it is a very
> > strange variant.  It may be CPM oriented.  Can you tell me 1) is this
> > Pascal? and 2) What are the syntax rules for matching the END statements
> > with the conditionals?
> 
> 	1) Looks like Modula-2 or some derivat.
> 	2) ????
> 		
> 		Torsten.
 I haven't seen the assembler but it sounds like it might be BASIC-09, which
is a special language written for the OS-9 operating system which runs on
6809 and 680xx machines.  How to tell?

Some BASIC-09 giveaways:
END statements are structure dependent; i.e., an IF requires an ENDIF, a WHILE
requires an ENDWHILE, a LOOP requires an ENDLOOP, etc.

BASIC09 has NO GLOBAL VARIABLES
Parameters are received IN the body of the program with PARAM statements.


Is this any help?
Hope so.
-Barry

rwi@naucse.UUCP (Robert Wier) (10/11/88)

 In my previous posting, I had a code segment from the Motorola
 Freeware board, asking if it was Pascal.  Several have told me
 that it is Modula, and badly written Modula at that.  

 thanks to all those who sent notes -
 Bob Wier in Flagstaff, Az.  Northern Arizona University