Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SAIL compiler #843

Open
larsbrinkhoff opened this issue Apr 26, 2018 · 21 comments
Open

SAIL compiler #843

larsbrinkhoff opened this issue Apr 26, 2018 · 21 comments
Labels
sail Things from, or related to, Stanford AI lab.

Comments

@larsbrinkhoff
Copy link
Member

Compiler for SAIL, the Algol dialect.

Needed to build PUB, #841.

@larsbrinkhoff
Copy link
Member Author

@larsbrinkhoff
Copy link
Member Author

Also needed for pre-Pascal TEX. #867

@larsbrinkhoff larsbrinkhoff added the sail Things from, or related to, Stanford AI lab. label May 15, 2018
@TheFausap
Copy link
Contributor

I'm trying to recreate the SAIL compiler. I'm starting from the SAIL debugger BAIL.
I used the files in [NEW,AIL] (from SAILDART), and I also found some useful MIC files describing how to link them.
For BAIL we have ASMBAI.MIC. It should be a TOPS-10 file, but FAIL.200 uses the same standard, so assembling the file is ok, I basically did:

:FAIL
baiclc_bpdahd,baiclc
[etc]

but the file BAISM1 has some warnings:

 ENTER  UNDEF   000023'
 RESET  UNDEF   000000'
  EXIT  UNDEF   000056'
RELEAS  UNDEF   000055'
PROGRAM BREAK   002253'
ELAPSED CPU TIME 0:00.000 

those UNDEF are related (according the latest manual @larsbrinkhoff put in the repo) to some UUO.

- RELEAS 071000,,0 UUO
- ENTER 077000,,0 UUO
- RESET CALLI 0 UUO
- EXIT CALLI 12 UUO

the two files (BAISM1 and BSM1HD) are here: https://gist.github.com/TheFausap/c6f2cb8d2215d3e5f3e28d182d345d9c

Eventually I got a REL file anyway, and according the mic file,

.r fail
*baiclc←bpdahd,baiclc
*baiio1←bpdahd,baiio1
*baiio2←bpdahd,baiio2
*baimsc←bpdahd,baimsc
*baiprc←bpdahd,baiprc
*baism1←bsm1hd,baism1
*baipd9←baipd9
.exec baism1

I should exec BAISM1(this is a sort of loader of the other REL files). But how can I run a REL file generated by FAIL ? Using DECUUO ?

@larsbrinkhoff
Copy link
Member Author

I don't think you can run a REL file in DECUUO. Can TOPS-10 or WAITS do this? A REL file would normally need to be linked to be run.

DECUUO can run TOPS-10 and WAITS programs. Like those with an extension of EXE, SHR, LOW, DMP.

@TheFausap
Copy link
Contributor

Ok. The exec command in TOPS-10, compile (if needed) then loads the REL file into the core, and run it.
To do that in ITS, maybe we should use a loader...

@larsbrinkhoff
Copy link
Member Author

Ah yes, that sounds like a TOPS-10 thing to do.

FAIL in ITS is hacked to write the MIDAS/STINK REL format. So you should be able to use STINK to make an executable file from one or more REL files.

It uses a peculiar command syntax. See .INFO.; STINK DOC for information. There are also a few sample LOADER files in the repository.

@atsampson
Copy link
Contributor

BAIL.DOC says that when you compile a program with the /B switch, BAIL.REL "is loaded automatically when the program is loaded". There's an example of starting and using it in there.

MAPS shows MC: DECSYS; BAIL REL, so try putting it there, then compiling a SAIL program with /B?

@rmaldersoniii
Copy link

I keep seeing a lot of interest in WAITS programs, in the form of forcing^Wporting them into ITS.
Would anyone be interested in an account on a real WAITS system (KL-1095 running WAITS, with
emulated RP07 disks), for an experience different from ITS?

@TheFausap
Copy link
Contributor

@larsbrinkhoff I tried to copy the idea of fail.loader, but I'm not sure what is the output: a TS file ?
I did in this way:

:STINK
*MBAISM1;JOBDATL$$
*JBAISM1TD$$
*

$ is ESC.
But I have no outputs from commands and also I have no TS BAISM1 (I should have this or not?).
@atsampson I think running this BAISM1, I should have the BAIL.REL as output.

@TheFausap
Copy link
Contributor

Ok, maybe I understood my error: if I don't use a command file, I need to give all the commands in one line separated by ESC and ending with a double ESC.
So, this should be: MBAISM1$JBAISM1$TD$$ and in this case my STINK job became BAISM1 (if I do $$v I can see that).

But now ? I could use a PDUMP to create a TS file or what ?

@TheFausap
Copy link
Contributor

@rmaldersoniii This could be nice. Thanks!

@larsbrinkhoff
Copy link
Member Author

Yes, you do have to get your ESCs right. I think you don't need everything on one line; try ending all commands with double ESC. (Also known as ALTMODE.)

Yes, the STINK output is a regular "TS" ITS executable, in SBLK format.

I got a WAITS account the other day, and it's very interesting to snoop around! There's a long-standing tradition of porting between ITS and WAITS. Let's keep it going.

@TheFausap
Copy link
Contributor

I'm looking the build procedure of DRAW. I do not understand all the steps:

SUDS drawing program
[...]
respond "" ":fail d\r" --- use the file d.files as command procedure for FAIL and generate REL files
[...]
respond "
" ":stink d\r" --- call stink using d.loader as command procedure

The file d.loader contains (side-question: how can I type an ESC char in :

msail;jobdat$1
mDRAW;d$1
MWL;BOARDS$L
jd$1?Wtd

[...]

respond "??" "\033\0331L decsys; decbot bin\r"

Now I'm lost: Are the two ESC completing the commands in the d.loader file ?
If so, I return to DDT, but the following command (L decsys... etc) is a STINK command not a DDT one.

respond "*" ".jbsa/strt\r"
respond ":" "56/107\r"

Another question: the commands in STINK should be terminated by double ESC... but I cannot see them.

respond "\n" ":pdump datdrw; d bin\r"
respond "*" ":kill\r"

The next step is the pdump, and this is ok.
If I do something similar, creating a loader file:

Msail;jobdat$1
Mfausap;baism1$L
jbaism1$1?td

I have an Non-existent memory error. I tried with/without W

@larsbrinkhoff
Copy link
Member Author

I'll try to adress all your questions.

:fail d assembles the file D >. D FILES isn't involved.

Correct, :stink d uses D LOADER.

You can type an ESC character in EMACS like this: Control-Q ESC

The command in D LOADER isn't 1 but l. Maybe your terminal font doesn't make a clear distinction between 1 and lowercase l. msail;jobdat$l is two commands: M...$ sets the file name, and L loads a REL file.

The build script uses ?? to see STINK is finished. If you try :cwd draw and then :stink d in ITS you can see better what's going on.

$$1L isn't a STINK command but a DDT command. Last in the LOADER script is the command D, which makes STINK exit to DDT. $L is the DDT command to load a file. If you type double ALTMODE, DDT will merge instead of load. If you add a 1 prefix argument, DDT will skip the symbo table. So in this case, insert DECSYS; DECBOT BIN into the D job core image and ignore the symbols.

I think double ESC isn't needed when STINK reads from a file.

The NXM may be because you use the 1 STINK command instead of L.

@TheFausap
Copy link
Contributor

Thanks Lars. the NXM error is generated by loading BAISM1, and I checked with STINK that relocation factor is 100, so may this address is wrong.
But how can I be sure ?

@larsbrinkhoff
Copy link
Member Author

Sorry, I can't answer that. I don't know. But the NXM is a serious error not matter what STINK does, and that should be looked into.

@larsbrinkhoff
Copy link
Member Author

Since we have made progress on PUB (#841), it's would be nice to get the SAIL compiler going.

I see files TS SAILV and TS SAILC. From recent snooping in the PUB directory, I see SAILV may be the "file salvager". Strings in TS SAILV match those in PUB; LISTER 1 and PUB; PSAILV 2. The message "NULLS DELETED" makes me think it's a program to make an ordinary text file from a file saved by the E editor in use at SAIL.

TS SAILC would then be the compiler, by my guess.

CC @bgbaumgart

@larsbrinkhoff
Copy link
Member Author

I tried the binary in SAIL; TS SAILC, but it doesn't seem to work quite right. Here's an attempt to compile the PUB; ABC 10 file.

*:sail;sailc
*abc_abc.10
ABC.10 1
  SHARE. 1
    GLOBE. 1
      SITE. 1 2
      COMMON. 1 2
     2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
?BOGUS IDENTIFIER IN IDENTIFIER LIST.
GLOBE, PAGE 16
00300           LONG,
                      comment, TRUE in a LONG etc. command;

^

@larsbrinkhoff
Copy link
Member Author

The line that SAILC complains about is this one:

        LONG, comment TRUE in a LONG etc. command;

I compared with the Saildart file GLOBE.SAI[PUB,SYS]3 and found this:

comment	LONG, comment TRUE in a LONG etc. command.  (*** Seems not to be used,
		 and is no longer legal in Sail anyway.  Flushed by MJC, 6/1/77.);

@larsbrinkhoff
Copy link
Member Author

Now this:

ABC.10 1
  SHARE. 1
    GLOBE. 1
      SITE. 1 2
      COMMON. 1 2
     2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
    PROCS. 1 2
WARNING: Form-feed while scanning false conditional compilation.
Last source-file macro: PROCEDURES  00500/1
Current macro: FALSE
 3 4 5 6
WARNING: Form-feed while scanning false conditional compilation.
Last source-file macro: PRIVATE  06300/5
Current macro: ENDC
 7
WARNING: Form-feed while scanning false conditional compilation.
Last source-file macro: PRIVATE  06200/6
Current macro: PRIVATE
 8 9 10
?UNDECLARED IDENTIFIER: SHARE, PAGE 1
04700      COMMENT
                   EXTERNAL AND FORWARD PROCEDURES ;

@larsbrinkhoff
Copy link
Member Author

Hello @kahrs,

Here are some notes from me attempting to run the SAIL compiler found on ITS, to compile PUB:
#843 (comment)

I had a false recollection I was trying to compile the SAIL compiler itself, but that was not the case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sail Things from, or related to, Stanford AI lab.
Projects
None yet
Development

No branches or pull requests

4 participants