1

I'm looking over examples of FOCAL code, and I see that group numbers in the examples start with a 0 if need be. That is, it's 01.10, not 1.10. Was a leading zero optional?

4

Yes. This is FOCAL 69 running under TSS/8, on a PiDP-8.

*1.1 TYPE "HELLO WORLD",!!
*GO
HELLO WORLD

*WRITE ALL
C-FOCAL,1969

01.10 TYPE "HELLO WORLD",!!

Observe I gave the line number as 1.1; the listing from 'write all' rendered it as 01.10.

(As far as I can recall, this is my first-ever FOCAL program. Probably my last, too.)

1
  • Up-voted also for first try with new language. It is also a correct answer showing the point clearly. – UncleBod Oct 3 '19 at 4:16
2

I used FOCAL briefly back in about 1970, and I don't remember anything about leading zeros at all.

The programming manual doesn't mention them in section 2.9 where it introduces line numbers, but they do appear in the program listings later on.

I suppose they might have made the listing look neater, since the valid line numbers were 1.01 through 15.99 (excluding 1.00, 2.00, … 15.00).

3
  • 1
    Page 4-11 in the linked manual has a listing of a FOCAL program, with leading 0 for line numbers. Probably a way for the print routine to pretty-print the line numbers so that the . lines up. – UncleBod Sep 30 '19 at 17:36
  • Ahh, I had never considered this could be an output-only thing. – Maury Markowitz Sep 30 '19 at 17:39
  • And following that lead, it seems it is indeed a WRITE side-effect, and you can indeed GOTO 1.1 – Maury Markowitz Sep 30 '19 at 18:05
2

Wikipedia seems to have a good explanation of this:

As with JOSS, [program] line numbers are fixed-point numbers consisting of two two-digit integers separated by a period. In FOCAL-8, valid line numbers range from 1.01 through 31.99. When printed out, using WRITE, leading zeros will be added so that all line numbers will be a total of five characters including the period, but statements referring to those lines do not need the leading zeros, for instance, GOTO 1.10

It goes on to explain how the left-hand part is treated as a grouping element for lines:

The number on the left of the period is known as the "group number". Groups provide some level of code organization that is lacking in languages like Fortran or BASIC. The primary use of these was to use a group as a subroutine which can be called with DO, for instance, DO 5 which will jump to the subroutine written in group 5. The editor also used these during edit-time, for instance, one could WRITE 2 to produce a listing of the code in group 2, or ERASE 4 to delete all of the lines in group 4.

1
  • 2
    "Wikipedia seems to have a good explanation of this:" - well it does now... I just rewrote the whole article :-) – Maury Markowitz Oct 1 '19 at 19:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.