"Illegal expression"

This small program returns an error message--"Illegal expression"--pointing to the subroutine MATPT3D in which PTORIG is the offender. This seems like a small thing, but the other programs I use have been giving me the same error. Where have I gone wrong?

DIM PTORIG(4), TRANS(4,4), PTFINAL(4)
For I = 1 to 4
LET PTORIG(I) = 1
For J= 1 to 4
LET TRANS(I,J) = 1
NEXT J
NEXT I
For I = 1 to 4
Print “PTORIG(“; I; “)=”; PTORIG(I)
NEXT I
CALL MATPT3D(PTORIG,TRANS,PTFINAL)
For I = 1 to 4
Print “PTFINAL(“; I; “)=”;PTFINAL(I)
Next I
END
SUB MATPT3D (PTORIG, TRANS, PTFINAL )
!
! THIS ROUTINE TRANSFORMS X,Y,Z GLOBAL COORDINATES
! INTO XS,YS,ZS COORDINATES
!
LET X = PTORIG(1)
LET Y = PTORIG(2)
LET Z = PTORIG(3)
LET W = PTORIG(4)
!
LET XS = X * TRANS(1, 1) + Y * TRANS(2, 1) + Z * TRANS(3, 1) + W * TRANS(4, 1)
LET YS = X * TRANS(1, 2) + Y * TRANS(2, 2) + Z * TRANS(3, 2) + W * TRANS(4, 2)
LET ZS = X * TRANS(1, 3) + Y * TRANS(2, 3) + Z * TRANS(3, 3) + W * TRANS(4, 3)
LET WS = X * TRANS(1, 4) + Y * TRANS(2, 4) + Z * TRANS(3, 4) + W * TRANS(4, 4)
!
LET PTFINAL(1) = XS
LET PTFINAL(2) = YS
LET PTFINAL(3) = ZS
LET PTFINAL(4) = WS
!
END SUB

Comments

<code> and </code> markers

When you include a sample of code in your message, please use the code tags. That makes it easier for us to copy your code and paste it into our own compiler for testing. Otherwise quote marks can get scrambled. Thanks!

Re: code markers ...

TomL_12953 ... I know virtually nothing about HTML, although I did buy a Wendy Willard book, HTML A Beginner's Guide Second Edition a couple of years ago.

By the way, when I post a Reply, there is a line of text in the Comment box that I have to delete every time. It should be erased. Regards ... Tom M

Code Markers

I don't know HTML either except that a word in brackets < > starts a section and the same word (also in brackets) preceded by / ends the section. When you start your reply, the allowed HTML tags are listed for you. Before your first line of code put the word, "code" replacing the quotes by < and >
and after your last line of code, use "/code" and again replace the quotes by < and >.

Re: code markers

TomL_12953 ... Thanks for the tutorial! I'll do that from now on. Regards ... Tom M

Re: illegal expression #2

jimf ... Before I edited your program listing I "parsed" the characters in your listing (I copied & pasted your
Forum message). There were six ASCII 147 characters and two ASCII 148 characters (three 147s and one 148 on program lines 13 and 17). They are the 3 left quotes and the 1 right quote.

Two questions ... Is your computer a Macintosh? and, Are you using a font that's not Courier? Regards ... Tom M

Re: illegal expression

jimf ... I have edited your program listing, and it RUN's without error. Regards ... Tom M

! Filename: jimf_20080310_tjm.tru

DIM PTORIG(4), TRANS(4,4), PTFINAL(4)
For I = 1 to 4
LET PTORIG(I) = 1
For J= 1 to 4
LET TRANS(I,J) = 1
NEXT J
NEXT I
For I = 1 to 4
Print PTORIG( I );"="; PTORIG(I)
NEXT I
CALL MATPT3D(PTORIG(),TRANS(,),PTFINAL())
For I = 1 to 4
Print PTFINAL( I );"=";PTFINAL(I)
Next I
END
SUB MATPT3D (PTORIG(), TRANS(,), PTFINAL() )
!
! THIS ROUTINE TRANSFORMS X,Y,Z GLOBAL COORDINATES
! INTO XS,YS,ZS COORDINATES
!
LET X = PTORIG(1)
LET Y = PTORIG(2)
LET Z = PTORIG(3)
LET W = PTORIG(4)

LET XS = X * TRANS(1, 1) + Y * TRANS(2, 1) + Z * TRANS(3, 1) + W * TRANS(4, 1)
LET YS = X * TRANS(1, 2) + Y * TRANS(2, 2) + Z * TRANS(3, 2) + W * TRANS(4, 2)
LET ZS = X * TRANS(1, 3) + Y * TRANS(2, 3) + Z * TRANS(3, 3) + W * TRANS(4, 3)
LET WS = X * TRANS(1, 4) + Y * TRANS(2, 4) + Z * TRANS(3, 4) + W * TRANS(4, 4)

LET PTFINAL(1) = XS
LET PTFINAL(2) = YS
LET PTFINAL(3) = ZS
LET PTFINAL(4) = WS
!
END SUB

Arrays in CALL Statement

Tom M: You don't need the parentheses in the CALL statement, only in the SUB statement. In fact, ANSI standard BASIC doeesn't even allow the parens in the CALL although TB permits them. The following will run in ANSI standard as well as TB (the EXTERNAL is required in ANSI and allowed in TB):


DIM PTORIG(4), TRANS(4,4), PTFINAL(4)
For I = 1 to 4
LET PTORIG(I) = 1
For J= 1 to 4
LET TRANS(I,J) = 1
NEXT J
NEXT I
For I = 1 to 4
Print "PTORIG(";I;")="; PTORIG(I)
NEXT I
CALL MATPT3D(PTORIG,TRANS,PTFINAL)
For I = 1 to 4
Print "PTFINAL(";I;")=";PTFINAL(I)
Next I
END
EXTERNAL SUB MATPT3D (PTORIG(), TRANS(,), PTFINAL())
!
! THIS ROUTINE TRANSFORMS X,Y,Z GLOBAL COORDINATES
! INTO XS,YS,ZS COORDINATES
!
LET X = PTORIG(1)
LET Y = PTORIG(2)
LET Z = PTORIG(3)
LET W = PTORIG(4)
!
LET XS = X * TRANS(1, 1) + Y * TRANS(2, 1) + Z * TRANS(3, 1) + W * TRANS(4, 1)
LET YS = X * TRANS(1, 2) + Y * TRANS(2, 2) + Z * TRANS(3, 2) + W * TRANS(4, 2)
LET ZS = X * TRANS(1, 3) + Y * TRANS(2, 3) + Z * TRANS(3, 3) + W * TRANS(4, 3)
LET WS = X * TRANS(1, 4) + Y * TRANS(2, 4) + Z * TRANS(3, 4) + W * TRANS(4, 4)
!
LET PTFINAL(1) = XS
LET PTFINAL(2) = YS
LET PTFINAL(3) = ZS
LET PTFINAL(4) = WS
!
END SUB

your errors

You have two errors.

The left quotes in the print statements are not recognized.

You need parentheses in the sub statement to flag the arrays.

Roger