Record of some of the computer tech I deal with so that it's documented at least somewhere.

Sunday, 6 December 2009

4th-compiler error reporting

Compiling; Word 444: Undefined name

is a bogus error message. The only way to match that word number is to compile the code !!
So I edited the compiler :

4th-3.5d3-unix/sources/comp_4th.c:/^Object->ErrNo = M4NONAME;/
s/$/printf("WORD %s", p);/


so it spits out the duff word
Compiling; Word 444: Undefined name
WORD dup4


which I suppose is ok for a start but I can do better than that but let's not get sidetracked

as an aside, programming in Lunix code is like going back in time. I mean FILE* !! gimme a break.

2 comments:

The Beez' said...
This comment has been removed by the author.
The Beez' said...

Not really. You can issue this at the command line:

4th cdq [yourprogram]

In that case 4tH will decompile the code up to the point where the error occured. You can achieve the same thing with the "D" key from the builtin menu.

Usually, you'll get a pretty good idea of where it stopped. Yes, a linenumber or the word itself would be much nicer, if it weren't for these restrictions:

(a) It will also compile blocks. Blocks don't have any line terminators. In fact, during tokenizing all graphic and whitespace characters are marked as WORD "terminators" and lose their distinction. This keeps the parser small, neat and simple.

(b) Since 4tH is essentially a LIBRARY, it is considered bad style to do any output from the compiler itself. As a matter of fact, 4tH itself produces the error message, not the compiler routine itself.