SPITBOL file suffix .sbl now allowed: In Memory of Anthony P. “Tony” McCann

The original version of Macro SPITBOL, created in the early 1970’s, was the joint work of Robert B. K. Dewar and Anthony P. “Tony” McCann.

At Robert’s suggestion, I spent two weeks in March 1976 in Leeds, England, where Tony was a professor at the University of Leeds, to learn more about Macro SPITBOL, mainly to see if we could apply some its technology to help in porting SETL to new machines. I was accompanied by my wife Karin and daughter Alison.

Tony and his wife Olga were wonderful hosts.

Working with Tony was a memorable experience. He was a very modest and soft-spoken gentleman.

As long as I can remember, the default extension for SPITBOL source files has been “spt,” pronounced, as one might guess, as “spit.”

Tony preferred the extension “sbl”, pronounced like the name “sibyl.” (I just looked up the meaning of ‘sybil’ and learned that it means “a woman in ancient times supposed to utter the oracles and prophecies of a god.”

Soon after I started working on SPITBOL in 2009, I was able to track down Tony’s email address, and received the following letter in reply in May, 2009:

Hi dave,

I am still living where I was when you visited Leeds all those years ago, when SPITBOL was still a new and needy product! However Olga my wife died from a heart attack 6 weeks ago so I am planning to sell and move next summer to the nearby village of Menston where two of my daughters and their families live.

I have been retired for 7 or 8 years from the software company with which I worked after leaving Leeds University in 1988 – I wanted to program for the last part of my working career rather than be a senior departmental administrator and it all turned out very well.

I hope you are well and presume that you may have reached retirement or thereabouts.

All the best
Tony

I learned not long after from Tony’s son that Tony had passed away.

He was a wonderful man, just wonderful.

I have just extended SPITBOL so that the suffix ‘sbl’ can also be used for SPITBOL source files.

From now on, whenever I run an existing SPITBOL program, or write a new one with the suffix “sbl,” I hope that will remind me of Tony.

If you have read this post, I hope you will be so reminded.

Anthony P. “Tony” McCann: May his Memory be a Blessing.”

Preprocessor in Fifty Lines of SPITBOL

As part of the conversion of SPITBOl to generate gnu assembler (gas) instead of NASM format, I learned that the GAS assembler is less powerful than that of NASM. For example, in NASM I could
use ‘define’ to map a register name to ‘eax’ in 32-bit mode, or ‘rax’ in 64-bit mode.

No problemo … SPITBOL to the rescue.

Here is the simple preprocessor I wrote in about twenty minutes:

*	rename registers according to word size

	target = host(0)
	target break('_') . os "_" rem . ws

	prefix = (eq(ws,32) '%e', '%r')

	word = (eq(ws,32) 'dword','qword')
	defines = 'M_WORD ' word ' '
	defines = defines 'D_WORD' ' ' (eq(ws,32) '.long', '.quad') ' '

	define('a(ref)')			:(a.end)
						:(next)
a	ident(os,"osx")				:s(a.err)
	a = '[' ref ']' 			:(return)
a.end

	define('m(ref)')			:(m.end)
m	ident(os,"osx")				:s(m.err)
	m = (eq(ws,32) 'd', 'q') 'word ptr ' ref ']' :(return)
m.end

	rmap = table(20)

	s = 'XLsiXRdiXSspXTsiWAcxWBbxWCdxW0axIAbp'
rinit	s len(2) . min  len(2) . reg = 		:f(rdone)
	rmap[min] = reg				:(rinit)
rdone
	rpat =  'IA' | ('X' any('LRST')) | ('W' any('ABC0')) 

next
	line = input				:f(end)

aloop	line breakx('A') . first 'A(' bal . ref ')' rem . last = first a(ref) last	:s(mloop)
	defs = defines

dloop
	defs break(' ') . key ' ' break(' ') . val ' ' =	:f(mloop)
dloop.1	line key = val				:s(dloop.1)f(dloop)

mloop	line breakx('M') . first 'M(' bal . ref ')' rem . last = first m(ref) last	:s(mloop)

rloop 	line rpat . reg = prefix rmap[reg]	:s(rloop)
	output = line				:(next)
err	output = 'error '
end

SPITBOL Status Report: NASM to GAS conversion complete

The conversion of asm.spt to generate gnu assembler (gas) code instead of nasm format is complete.

For those who know of such matters, I now generate att syntax, as it’s easier to generate from a program than intel syntax.

A few hours ago I finally got a compile with no errors, so I could run the executable.

It’s still dying early on. The good news is that with the use of gas I can now use ‘-g’ for debugging and get useful information from the ‘ddd’ debugger.

Simply put, I have debugging resources at hand that should suffice, so it’s just a matter of slogging along until its done. I don’t think it’ll take that long.

If you want to follow the details, or track my work, checkout branch ‘gas’.

I’ll keep you posted.

SPITBOL OSX Port Status, and a New Use for SPITBOL in the Port

I’ve spent the last month or so trying to port SPITBOL to Apple’s OSX.

What I thought would be a simple port — since the Linux x32 and x64 port was solid — turned out to be more daunting.

OSX is now 64-bits by default, and uses a different object format (macho) than does Linux (elf).

The main problem I’ve run into is that in 64-bits the storage model is different, so that code and data must use what is called RIP-addressing, where RIP stands for Relative to Instruction Pointer.

The first problem I ran into was a crash of NASM, the assembler I’ve been using.

Once the folks at NASM fixed that, I was unable to get even the simplest program working in RIP-mode for 64-bit OSX.

I then realized — I wish I had thought of this sooner — that OSX might support 32-bit mode.

Indeed it does. So I tried to build 32-bit SPITBOL using NASM.

This also gave problems, mainly in that it generated bad refs for the first three of so globals defined in m.s. I tried to get around this by moving their declaration to C code, but even after doing that, SPITBOL crashed.

So I have decided to convert the Minimal code generator to target GAS (the GNU assembler) and not NASM. This also involves converting the approximately 1500 lines of assembler needed to link the SPITBOL compiler to the runtime code written in C from NASM to GAS.

I’m in the midst of this, and it’s going well so far, so I’m hopeful the port will get done.

As part of the conversion from NASM to GAS, I’ve learned that GAS is less powerful when it comes to macros and substitutions. For example, in NASM, in 64-bit mode, I can write “%define WA RCX” to map the Minimal register WA to the machine register RCX. For 32-bits I can write “%define WA ECX.”

But I can’t do this in GAS, and so I wrote a program that, given the word size, maps the Minimal register names in upper-case to the corresponding hardware registers:

*	rename Minimal registers to x86_64 registers according to word size for x86_64

	prefix = (eq(host(0),32) "%e", "%r")

	rmap = table(20)
	rmap['XL'] = 'si';  rmap['XR'] = 'di';  rmap['XS'] = 'sp';  rmap['XT'] = 'si'
	rmap['WA'] = 'cx';  rmap['WB'] = 'bx';  rmap['WC'] = 'dx';  rmap['W0'] = 'ax' 
	rmap['IA'] = 'bp'

	rpat =  'IA' | ('X' any('LRST')) | ('W' any('ABC0')) 
next
	line = input				:f(end)
loop
	line rpat . reg = prefix rmap[reg]	:s(loop)
	output = line				:(next)
end

Being able to write code such as this, in a short time (it took about twenty minutes to write and debug) is why it is worth the long slog of implementation and porting.

It’s just such damn fun to write code in SPITBOL.

Ralph Griswold’s Oral History of the SNOBOL Languages

Courtesy of the YAHOO SNOBOL4 mailing list, I have just heard of a history of the SNOBOL programming languages  by Ralph Griswold, in the form of a transcription of an interview with Ralph in 1972. It is a PDF file:

Narrative Account of the Development of the SNOBOL Programming Languages by Ralph Griswold

GCC: The First Compiler With Its Own Flag

While trying to look up some information about the gcc compiler, I did a search on ‘gcc flag -m’.

Here’s a picture of the results from Google:

Search results for 'gcc flag -m'.

Search results for ‘gcc flag -m’.

This is the first time I have ever searched for info about a compiler option (they are also called flags) and gotten a picture of a real flag.

Thing is, I can’t find the picture of RMS on the flag.

Go figure.

Status Report on the Port of SPITBOL to Apple OSX

We are making progress porting SPITBOL to Apple’s OSX operating system. The needed files can be found in

github osx git repository.

The repository can be downloaded by the command

$ git clone http://github.com/hardbol/spitbol/osx

The makefile has been modified to have 64-bit osx as the default, so to build the system do

$ make

Test spitbol by running various test programs in the subdirectory .text/. For example

$ ./spitbol test/hi.spt

To see if the program runs at all, try

$ ./spitbol

This produces several lines with help information. Note that running spitbol with no arguments just shows the program link is complete and that at least part of the C runtime is working. This does not test any of the translation of the Minimal source code to assembler.

The current status is that the help text can be printed, but even the simplest test yields

Bus error: 10

We will keep you posted.

On a separate front, one user reported problems building 32-bit SPITBOL. The makefile has been updated so that it works using gcc on a 32-bit Linux system.

On the Merit of Transparent Console Windows in Ubuntu Linux

I use Linux Mint — a variant of Ubunbu Linux — for my day to day programming. Here’s a screen shot of what my screen usually looks like:

Usual mode - two console windows.

Usual mode – two opaque terminal windows.

Above you seen two terminal windows. I use the KDE Konsole program; this is my normal mode. I do edits in the right window. I use the left window to view output, search files,
and so forth.

Here’s another mode I’ve just started using:

Screenshot-transparentTwo opaque terminal windows with transparent window in middle

See the difference?

There’s a new terminal window in the middle, but it’s transparent — you can see through it to the windows below.

Now I had known about transparent terminal windows for some time, but I had never never gotten around to trying them. I was happy with my usual mode of just two opaque windows.

A couple of weeks ago I updated my desktop to use the latest version of Linux Mint. Though Mint comes with the Konsole program, you have to dig around in the menus to find it.
There’s always a quick link to a terminal program in easy view, but it’s not for Konsole.

It turns out this version of Mint configures that default terminal program to use a transparent screen. So I tried it, and finally appreciated the advantage of the
transparency.

Though the transparency is a nuisance when just editing text, it’s great for other situations.

For example, if I need to do a small task, and don’t want to disturb my two normal windows, I just open up a transparent window.

The main advantage I’ve found is that if I’m looking at a web page with instructions on how to do something, then I can open a transparent window, view the instructions
through the window, and enter them directly with much less chance of error.

  • Pages

  • May 2015
    M T W T F S S
    « Feb    
     123
    45678910
    11121314151617
    18192021222324
    25262728293031
  • RSS The Wayward Word Press

  • Recent Comments

    daveshields on Ralph Griswold’s Oral Hi…
    Peter Capek on Ralph Griswold’s Oral Hi…
    daveshields on Status Report on the Port of S…
    Howard Bussey on Status Report on the Port of S…
    daveshields on Version 15.01 of Spitbol Now A…
  • Archives

  • Blog Stats

  • Top Posts

  • Top Rated

  • Recent Posts

  • Archives

  • Top Rated