Forums: Forum of Decimal BASIC (Thread #39388)

Error Compiling Program (2018-04-03 02:48 by toml12953 #81022)

Tis program works in Decimal BASIC but gives an error when trying to compile it

DECLARE EXTERNAL FUNCTION F
INPUT PROMPT "Enter semimajor axis a: ":a
INPUT PROMPT "Enter semiminor axis b: ":b
INPUT PROMPT "Enter Theta0: ":theta0
INPUT PROMPT "Enter Theta1: ":theta1
LET S = F(a,b,Theta1) - F(a,b,Theta0)
PRINT "Area =";S
END
EXTERNAL FUNCTION F(a,b,t)
LET F = a*b/2*(t-ATN((b-a)*SIN(2*t)/(b+a+(b-a)*COS(2*t))))
END FUNCTION


The error is:
Free Pascal Compiler version 3.0.4 [2018/02/25] for x86_64
Copyright (c) 1993-2017 by Florian Klaempfl and others
NoName.lpr(41,133) Fatal: Syntax error, ")" expected but "identifier S" found
Fatal: Compilation aborted

The Pascal line is:
init( true , false , false , false ,BMP801,17179869184,14,0,12,'Consolas',0,'D:\LANGS\BASICAcc2\My BASIC Programs\Area Using Kepler's Second Law',10);

Reply to #81022×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) Login

Re: Error Compiling Program (2018-04-03 04:53 by toml12953 #81023)

[Reply To Message #81022]
> Tis program works in Decimal BASIC but gives an error when trying to compile it
>
> DECLARE EXTERNAL FUNCTION F
> INPUT PROMPT "Enter semimajor axis a: ":a
> INPUT PROMPT "Enter semiminor axis b: ":b
> INPUT PROMPT "Enter Theta0: ":theta0
> INPUT PROMPT "Enter Theta1: ":theta1
> LET S = F(a,b,Theta1) - F(a,b,Theta0)
> PRINT "Area =";S
> END
> EXTERNAL FUNCTION F(a,b,t)
> LET F = a*b/2*(t-ATN((b-a)*SIN(2*t)/(b+a+(b-a)*COS(2*t))))
> END FUNCTION
>
>
> The error is:
> Free Pascal Compiler version 3.0.4 [2018/02/25] for x86_64
> Copyright (c) 1993-2017 by Florian Klaempfl and others
> NoName.lpr(41,133) Fatal: Syntax error, ")" expected but "identifier S" found
> Fatal: Compilation aborted
>
> The Pascal line is:
> init( true , false , false , false ,BMP801,17179869184,14,0,12,'Consolas',0,'D:\LANGS\BASICAcc2\My BASIC Programs\Area Using Kepler's Second Law',10);
>

The problem seems to be with the apostrophe in the file name (Area Using Kepler's Second Law) When I removed it, the program compiled OK.

Reply to #81022

Reply to #81023×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) Login