Groups | Search | Server Info | Login | Register
Groups > comp.databases.pick > #2356
| From | "Frank Winans" <fwinans@sbcglobal.net> |
|---|---|
| Newsgroups | comp.databases.pick |
| Subject | maybe need a lint checker application program to preen basic programs? |
| Date | 2015-07-31 14:08 -0500 |
| Message-ID | <Ca2dnUtc_sg0WibInZ2dnUU7-QmdnZ2d@posted.internetamerica> (permalink) |
Not all bad program code gets caught at compile time;
but a really really comprehensive error checker would bog down the compiler badly.
A middle ground might be a un*x-like 'lint' program that one could run on their
production software source code as a final paranoid check, even if it runs all night.
Here's an example bad program that compiles cleanly
01 * {I know nnnEnn and nnnFnn are scientific notation constants in some
02 * other languages, but don't think they are part of basic}
03 * But they generally won't be noticed as bad syntax at compile time...
04 *
05 * Variable names are assumed to start with a letter;
06 * numbers found before first variable on a line are assumed to be a
07 * program label number, even without any ":" or space after the 'label'.
08 *
09 1E3 = 6 ;* compiler treats this as 1: E3 = 6 (that is, 1 is a label number)
10 crt 'e3 is ':E3 ;* sez e3 is 6
11 *
12 * alphabetic text after a numeric constant is presumed to be a mask expr
13 * though I'm not sure what 'E3 + 4' is supposed to mean in real life...
14 crt 1E3 + 4 ;* sez 10000.0
15 crt 2E3 ;* sez 2.000000
16 goto 7 ;* proves 7frog below is parsed as if it were 7: frog = 42
17 crt 'dead code' ;* does not get executed
18 7frog = 42
19 crt 'frog is ':frog ;* sez frog is 42
20 stop
21 end
What features are worth putting in such a 'lint' program is highly debatable, but perhaps;
(imperfectly, I'm sure) find variables that are used before being set,
(many basics give error msgs about that, but only at run time)
variables set but never used {so that name was probably mis-typed by author}
numeric labels with neither space nor ":" after them
suspicious-looking mask expressions {author left out an intended '+'
operator}
and that is a very broad term, 'suspicious', hence elicits a huge
block of
program logic. Maybe just log a warning if that form not used in any
other
certified-ok production programs in the same account, or if involves
a
non-trivial variable name that is also used in a non-masking role in
same prog?
Back to comp.databases.pick | Previous | Next | Find similar
maybe need a lint checker application program to preen basic programs? "Frank Winans" <fwinans@sbcglobal.net> - 2015-07-31 14:08 -0500
csiph-web