DIRECTORY RunRegressions, XMesaProcs; XMesaCmplr1: PROGRAM IMPORTS RunRegressions, XMesaProcs = BEGIN filename: LONG STRING = "XMesaCmplr1"L; XMesaCall1: PROCEDURE = { XMesaProcs.PrintS[filename]; XMesaProcs.PrintCR; TestErrorRoutines[]; --make sure test routines work XMesa1a[]; --identifiers,declarations XMesa1b[]; --Basic Types XMesa1c[]; --Expressions and operators XMesa1d[]; --Constants:floating,integer,enumeration,character XMesa1e[]; --storage classes of objects XMesa1f[]; --string literals XMesa1g[]; --scope of identifiers XMesa1h[]; --linkage of identifiers XMesa1i[]; --name spaces of identifiers XMesaProcs.PrintS["Done"L]; XMesaProcs.PrintCR; }; --end of XMesaCall1 TestErrorRoutines: PROCEDURE = { XMesaProcs.PrintS["The following tests just verify that the error reporting routines"L]; XMesaProcs.PrintCR; XMesaProcs.PrintS["work correctly. Disregard the following messages (until"L]; XMesaProcs.PrintCR; XMesaProcs.PrintS[" \"Done testing error reporting routines\" appears below)."L]; XMesaProcs.PrintCR; XMesaProcs.Isequal[-15, -15, 90, filename]; XMesaProcs.Isequal[-16, -15, 91, filename]; XMesaProcs.Isnotequal[-16, -15, 92, filename]; XMesaProcs.Isnotequal[-16, -15, 93, filename]; XMesaProcs.Checkforpos['a, 94, filename]; XMesaProcs.Checkforpos[377C, 95, filename]; XMesaProcs.IsCardequal[15, 15, 96, filename]; XMesaProcs.IsCardequal[16, 15, 97, filename]; XMesaProcs.IsLongCardEqual[LONG[15], LONG[15], 98, filename]; XMesaProcs.IsLongCardEqual[LONG[16], LONG[15], 99, filename]; XMesaProcs.Isboolequal[TRUE, TRUE, 100, filename]; XMesaProcs.Isboolequal[TRUE, FALSE, 101, filename]; XMesaProcs.Ischarequal['a, 'a, 102, filename]; XMesaProcs.Ischarequal['b, 'a, 103, filename]; XMesaProcs.Islongequal[LONG[-15], LONG[-15], 104, filename]; XMesaProcs.Islongequal[LONG[-16], LONG[-15], 105, filename]; XMesaProcs.Isnotboolequal[TRUE, TRUE, 106, filename]; XMesaProcs.Isnotboolequal[TRUE, FALSE, 107, filename]; XMesaProcs.Isnotcharequal['a, 'a, 108, filename]; XMesaProcs.Isnotcharequal['b, 'a, 109, filename]; XMesaProcs.PrintCR; XMesaProcs.PrintS["Done testing error reporting routines"L]; XMesaProcs.PrintCR; XMesaProcs.PrintCR}; XMesa1a: PROCEDURE = { --identifiers,declarations a: INTEGER = 1; b: INTEGER = 2; c: INTEGER = 3; abcdefghijklmnopqrstuvwxyz: INTEGER ¬ 1; ABCDEFGHIJKLMNOPQRSTUVWXYZ: INTEGER ¬ 2; a23456789012345678901234567890: INTEGER ¬ 3; --starting with a letter A23456789012345678901234567890: INTEGER ¬ 4; cabcdefghijklmnABCDE2345678: INTEGER ¬ 5; --any combo of letter|digit cabcdefghijklmn: INTEGER ¬ 6; --the first umpteen char same as above imports: INTEGER ¬ 5; process: INTEGER ¬ 5; <<-- multiple statements online reserved word in lower case is distinct >> abc, def, ghi: INTEGER ¬ -6; --multiple declarations ANYTHING, CONTINUED, MYOWNIDENT: INTEGER ¬ 10; XMesaProcs.Isnotequal[ abcdefghijklmnopqrstuvwxyz, ABCDEFGHIJKLMNOPQRSTUVWXYZ, 100, filename]; XMesaProcs.Isnotequal[ a23456789012345678901234567890, A23456789012345678901234567890, 110, filename]; XMesaProcs.Isequal[cabcdefghijklmnABCDE2345678, 5, 120, filename]; XMesaProcs.Isnotequal[ cabcdefghijklmn, cabcdefghijklmnABCDE2345678, 130, filename]; XMesaProcs.Isequal[imports, process, 140, filename]; XMesaProcs.Isequal[ANYTHING, 10, 150, filename]; XMesaProcs.Isequal[CONTINUED, 10, 160, filename]; XMesaProcs.Isequal[MYOWNIDENT, 10, 170, filename]; XMesaProcs.Isequal[abc, ghi, 180, filename]; XMesaProcs.Isequal[def, ghi, 190, filename]; XMesaProcs.Isequal[ (a + b - c), (a + b - c), 200, filename]; --white space ,tab and CR XMesaProcs.Isequal[(c + b), 5, 210, filename]; XMesaProcs.Isequal[b, 2, 220, filename]; XMesaProcs.Isequal[a, 1, 230, filename]; }; XMesa1b: PROCEDURE = { --Basic Built-in Types i, j: INTEGER ¬ 1; li: LONG INTEGER ¬ 2; card: CARDINAL ¬ 3; floatneg, floatpos: REAL; g: BOOLEAN; lowerCaseA, lowerCaseJ, asciiCR, asciiLF, upperCaseA, upperCaseJ, extra: CHARACTER; charArray: ARRAY [0..82) OF CHAR ¬ [ '@, 'A, 'B, 'C, 'D, 'E, 'F, 'G, 'H, 'I, 'J, 'K, 'L, 'M, 'N, 'O, 'P, 'Q, 'R, 'S, 'T, 'U, 'V, 'W, 'X, 'Y, 'Z, 'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, 'j, 'k, 'l, 'm, 'n, 'o, 'p, 'q, 'r, 's, 't, 'u, 'v, 'w, 'x, 'y, 'z, '¬, '­, '!, '@, '#, '$, '%, '~, '&, '*, '(, '), '_, '-, '+, '=, '}, '{, '<, '>, '}, '{, '], '[, ':, ';, '", '?, '/]; XMesaProcs.Isequal[6400, 6400D, 240, filename]; --numeric literals XMesaProcs.Isequal[6400D, 64D2, 250, filename]; XMesaProcs.Isequal[64D2, 14400B, 260, filename]; XMesaProcs.Isequal[14400B, 144B2, 270, filename]; XMesaProcs.Isequal[144B2, 1900H, 280, filename]; XMesaProcs.Isequal[1900H, 19H2, 290, filename]; IF i = j THEN g ¬ TRUE; XMesaProcs.Isboolequal[g, TRUE, 300, filename]; IF (i + 1) # j THEN g ¬ FALSE; XMesaProcs.Isboolequal[g, FALSE, 310, filename]; lowerCaseA ¬ 'a; lowerCaseJ ¬ 'j; upperCaseA ¬ 'A; upperCaseJ ¬ 'J; asciiCR ¬ 15C; asciiLF ¬ 12C; XMesaProcs.Isboolequal[ ((upperCaseA - lowerCaseA) = (upperCaseJ - lowerCaseJ)), TRUE, 320, filename]; XMesaProcs.Isboolequal[((asciiCR - 3B) = asciiLF), TRUE, 330, filename]; XMesaProcs.Isboolequal[(upperCaseJ > upperCaseA), TRUE, 340, filename]; XMesaProcs.Isequal[ORD[upperCaseA], 101B, 350, filename]; FOR begin: INTEGER IN [0..82) DO XMesaProcs.Checkforpos[charArray[begin], 360, filename]; ENDLOOP; extra ¬ VAL[101B]; XMesaProcs.Ischarequal[extra, upperCaseA, 370, filename]; floatpos _ 1.0; XMesaProcs.Isrealequal[floatpos, 1.0, 520, filename]; floatneg ¬ -3.1415916; XMesaProcs.Isrealequal[ABS[floatneg], 3.1415916, 520, filename]; floatpos ¬ -floatneg; XMesaProcs.Isrealequal[floatpos, 3.1415916, 530, filename]; XMesaProcs.Isrealequal[125., 125.0, 540, filename]; XMesaProcs.Isrealequal[125, 12.5e1, 550, filename]; XMesaProcs.Isrealequal[12.5e1, 12.5E1, 560, filename]; XMesaProcs.Isrealequal[12.5e1, 1.25e2, 570, filename]; XMesaProcs.Isrealequal[125.e-2, 12.5e-1, 580, filename]; floatpos _ 1; XMesaProcs.Isrealequal[floatpos, 1.0, 551, filename]; i _ 1; floatpos _ i; XMesaProcs.Isrealequal[floatpos, 1.0, 552, filename]; card _ 1; floatpos _ card; XMesaProcs.Isrealequal[floatpos, 1.0, 553, filename]; floatpos _ 1.25; floatneg _ 2.75; floatpos _ floatpos + floatneg; XMesaProcs.Isrealequal[floatpos, 4.0, 554, filename]; floatpos _ 1.25; floatneg _ 1.05; floatpos _ floatpos - floatneg; XMesaProcs.Isrealequal[floatpos, 0.2, 555, filename]; floatpos _ 15.0; floatneg _ 3.0; floatpos _ floatpos * floatneg; XMesaProcs.Isrealequal[floatpos, 45.0, 556, filename]; floatpos _ 15.0; floatneg _ 3.0; floatpos _ floatpos/floatneg; XMesaProcs.Isrealequal[floatpos, 5.0, 557, filename]; floatpos _ 15.0; floatneg _ 3.0; floatpos _ MIN[floatpos, floatneg]; XMesaProcs.Isrealequal[floatpos, 3.0, 558, filename]; floatpos _ 15.0; floatneg _ 3.0; floatpos _ MAX[floatpos, floatneg]; XMesaProcs.Isrealequal[floatpos, 15.0, 559, filename]; floatpos _ 15.0; floatneg _ 3.0; IF floatpos > floatneg THEN NULL ELSE XMesaProcs.Isrealequal[1.0, .02, 561, filename]; IF floatpos >= floatneg THEN NULL ELSE XMesaProcs.Isrealequal[1.0, .02, 562, filename]; floatpos ¬ 10.0 / 7.0; }; XMesa1c: PROCEDURE = { --Expressions and operators i, i1, i2, i3, i4, i5: INTEGER; li: LONG INTEGER; c: CARDINAL; signalRaised: BOOLEAN ¬ FALSE; i1 ¬ 10; i2 ¬ -10; i3 ¬ MIN[i1, i2]; XMesaProcs.Isequal[i3, -10, 650, filename]; i4 ¬ MAX[i1, i2]; XMesaProcs.Isequal[i4, 10, 660, filename]; i5 ¬ ABS[i2]; XMesaProcs.Isequal[i5, 10, 670, filename]; i1 ¬ 1; i2 ¬ 2; i3 ¬ 5; XMesaProcs.Isequal[(i1 + i2 * -i3), -9, 680, filename]; XMesaProcs.Isequal[(i3 MOD i2), 1, 690, filename]; XMesaProcs.Isequal[(i3 - i3 MOD 5), 5, 700, filename]; XMesaProcs.Isequal[(i3 - i3 / 2), 3, 710, filename]; XMesaProcs.Isboolequal[(i1 + i1) = i2, TRUE, 720, filename]; XMesaProcs.Isboolequal[i1 # i2, TRUE, 730, filename]; XMesaProcs.Isboolequal[i1 < i2, TRUE, 740, filename]; XMesaProcs.Isboolequal[i1 NOT IN [5..10], TRUE, 750, filename]; XMesaProcs.Isboolequal[(i1 < i2 AND i2 < i3), TRUE, 760, filename]; XMesaProcs.Isboolequal[(i1 NOT IN [5..10]), TRUE, 770, filename]; XMesaProcs.Isequal[SUCC[i1], 2, 780, filename]; XMesaProcs.Isequal[PRED[i3], 4, 790, filename]; c ¬ 20; i ¬ c + c; --short unsigned operation XMesaProcs.Isequal[i, 40, 840, filename]; i ¬ -1; li ¬ i + i; XMesaProcs.Islongequal[li, -2, 850, filename]; i ¬ c + i; XMesaProcs.Isequal[i, 19, 860, filename]; i ¬ -1; li ¬ i + LONG[i]; XMesaProcs.Islongequal[li, -2, 870, filename]; }; XMesa1d: PROCEDURE = { --Constants:floating,integer,enumeration,character colortype: TYPE = {red, blue, green, yellow, purple, orange}; XMesaProcs.Isequal[0abcH, 0ABCH, 880, filename]; --hex number representation XMesaProcs.Isequal[0defh, 0DEFh, 890, filename]; XMesaProcs.Isequal[456, 1c8H, 870, filename]; IF FIRST[colortype] # red THEN XMesaProcs.PutFailMessage[875, filename]; XMesaProcs.Isnotcharequal['\n, 'n, 895, filename]; XMesaProcs.Isnotcharequal['\t, 't, 897, filename]; XMesaProcs.Isnotcharequal['\b, 'b, 900, filename]; XMesaProcs.Isnotcharequal['\l, 'l, 910, filename]; XMesaProcs.Isnotcharequal['\f, 'f, 920, filename]; XMesaProcs.Ischarequal['\", '", 930, filename]; XMesaProcs.Ischarequal['\150, 'h, 940, filename]; }; XMesa1e: PROCEDURE = { --storage classes of objects }; XMesa1f: PROCEDURE = { --string literals p:STRING ¬ "This is a test"; q:STRING ¬ "\"\\\b\f\n\t"; XMesaProcs.Ischarequal[p[0],'T, 941, filename]; -- this test fails if run a second time XMesaProcs.Ischarequal[q[1],'\\, 942, filename]; XMesaProcs.Ischarequal[q[2],'\b, 943, filename]; p[0] ¬ 0C; XMesaProcs.Ischarequal[p[0],0C,94, filename]; --writability }; XMesa1g: PROCEDURE = { --scope of identifiers }; XMesa1h: PROCEDURE = { --linkage of identifiers }; XMesa1i: PROCEDURE = { --name spaces of identifiers ident: INTEGER; a: RECORD [ident: INTEGER, other: INTEGER]; a.ident ¬ 8; ident ¬ 7; XMesaProcs.Isnotequal[ident, a.ident, 950, filename]; XMesaProcs.Isequal[a.ident, 8, 960, filename]; }; RunRegressions.RegisterTest[XMesaCall1, "test1"]; END... ` File: XMesaCmplr1.mesa - created by MW. Last edit: JKF 23-Jul-87 13:06:02 MW 10-Mar-87 16:09:54 Jim Foote January 19, 1988 5:46:15 pm PST Copyright (C) 1987 by Xerox Corporation. All rights reserved. lexical elements,basic data types and expressions identifiers any combo of letter/digit fully capitalized identifiers possible? fully captialized iden's possible? BOOLEAN CHARACTER (arithmetic relations, ORD, VAL) check all char array VAL check number of words each type occupies (see XMesaCmplr9 for machine dep. checks floating point REAL fixed to float(rounding) EXPRESSIONS operator precedence sign extend check relational operators,= # < <= > >= IN NOT IN ~< ~>= boolean operators AND OR NOT ~ function-like operators:LONG, BASE&LENGTH(strings) LONG ORD PRED SUCC FIRST LAST Type mixing escape conventions:\n,t,b,f,l,\,'," mainline Êd•NewlineDelimiter ™J˜J™2J™&J™J™)J˜J™=J˜J™1J˜šÏk ˜ J˜J˜ J˜—šÏn œœœ˜9Jš˜J˜Jšœ œœ˜'J˜Jšž œ œ˜˜J˜J˜JšœÏc˜4Jšœ Ÿ˜&Jšœ Ÿ ˜Jšœ Ÿ˜'Jšœ Ÿ2˜>Jšœ Ÿ˜(Jšœ Ÿ˜Jšœ Ÿ˜"Jšœ Ÿ˜$Jšœ Ÿ˜(J˜J˜J˜JšœŸ˜J˜J˜—šžœ œ˜ J˜XJ˜J˜OJ˜J˜SJ˜J˜+J˜+J˜.J˜.J˜)J˜+J˜-J˜-Jšœœœ˜=Jšœœœ˜=Jšœœœ˜2Jšœœœ˜3J˜.J˜.Jšœœœ˜