Bob's your uncle
Pages: 1 2
GavinWraith (26) 1563 posts |
I have just put back on my website I know that there are probably not many programmers around any more, and no doubt they have other fish to fry, but I thought it worth pointing out. The download contains the C sources. There are lots of ways it could be developed further – more libraries, more documentation. It uses a stack virtual machine, something no longer in fashion, which could be replaced by a faster register-based one. It could be converted from an interpreter to a compiler. The language itself would be better with multi-assignment (why should functions only return one argument?), but it is quite capable as it stands – not just a toy. If anybody does try it I would be grateful for feedback. |
Willard Goosey (5119) 257 posts |
Well, I’m glad to see this! ArmBob sounds pretty neat. I admit I like the idea of a C++ subset. |
Colin McMurchie (8817) 21 posts |
Hi Gavin, !armbob seems to work well so far as I have looked (I have even modified the odd example program) whereas GCC will not even run on this hardware. It may be worth pointing out that ‘Chess’ and Draw’ require a pre-existing RAM disk to show anything. Thanks, Colin McMurchie |
GavinWraith (26) 1563 posts |
Welcome to RISC OS and to the forum. I am glad to hear that ArmBob is being used. Maybe David Betz is too; it is thirty years since he wrote Bob.
You are quite right. Maybe I should put a Readme note in the examples directory. Bob was written to show how to write a simple interpreter in C for an object-oriented language. The C sources are very readable and I learned a lot from them. There are many ways in which they could be developed; turning them into a Bob compiler, for starters. Even the interpreter could probably be made a lot faster. I see it as an educational tool to tempt BASIC programmers toward wider horizons. |
Colin McMurchie (8817) 21 posts |
I don’t think I will be any help in developing !Armbob. I am no more than a dabbler in coding really. I might find something useful for other dabblers, perhaps. If so i will post again. |
David Pitt (3386) 1248 posts |
GCC 4.7.4 release 5 runs on my 512MB RPi1, and with 350MB free. OT for here but if assistance is required post any error messages to a new topic. I shall have a look at armbob, it is up and running on the RPi400 and Titanium. |
Colin McMurchie (8817) 21 posts |
Thank you David, I shall try to find out what I am doing wrong. |
Colin McMurchie (8817) 21 posts |
GCC is now working for me. I found out I had to tweak the memory through task manager first. It is good to learn something new every day. |
David Boddie (1934) 222 posts |
The original article about Bob is still online. There’s also a git repository on GitHub with the code, relicensed under the MIT license last year. |
GavinWraith (26) 1563 posts |
ArmBob is based on Bob 1.5. The code in the git repository carries Bob somewhat further – the compiler and interpreter are separated, and the OO is more developed – but I cannot find a version number. I can verify that it compiles with the latest Acorn C compiler, with the obvious tweaks: convert to Unix line-endings, change file-extension character from dot to forward-slash. I have not yet tried it with GCC, which will be necessary for VFP floats. I was not sure, until I saw the MIT license, what the legal status of this code was. I probably do not need to say that it is rare to find clearly-written C source-code that can be compiled under RISC OS. Almost everything demands a Unix, MacOS or Microsoft platform. So this is quite a juicy gift to RISC OS C-programmers who might like to toy with it (if there are any). David Betz used it for various projects: the NUON DVD player, his AdvSys adventure-writing system, an embeddable macro system, DROOL (David’s Recycled OO Language), TOOL on Code Project. I am not an expert on OO languages; my impression is that they are no longer flavour of the month because they present such an embarras de richesses . There are so many types of object and types of inheritance possible. Now let us see … if we can enhance Bob with a nil object, with multi-returns from functions and multi-assignment, a class-based SWI-interface , a faster register-based VM, … . |
David Boddie (1934) 222 posts |
I didn’t know about his NUON connection. AdvSys sounds familiar, though perhaps that’s because there were a few similar systems and it looks LISPish. His collection of GitLab repositories contains a few language implementations. It seems that, once you start writing them, it becomes addictive! |
David J. Ruck (33) 1636 posts |
Not all all, OO is regarded as de rigueur. |
mikko (3145) 123 posts |
There are now, thank God, dissenters |
David J. Ruck (33) 1636 posts |
One tacked on paragraph about what Facebook and Twitter might be experimenting with, does not an industry make. Encapsulation rules. |
GavinWraith (26) 1563 posts |
Indeed it does. And what a strain it puts on the programmer having to think up names for variables all the time. At one end of the scale we have the influence of mathematics with single-character names like x , useful for when the imagination flags but hopeless for imparting meaning, and at the other the monstrous verbosities of Java where you must SpellOut_every.laborious.CamelCase.detail . |
John Rickman (71) 646 posts |
Fortran got it right with a max of 6 chars |
mikko (3145) 123 posts |
But encapsulation isn’t unique to OOP; it’s achieved via abstraction in functional programming languages. OK, Haskell might be niche but the fact you can build .Net Core apps in F# demonstrates functional languages are carving out a bigger space for themselves. Whatever. Vive la différence! And OOP certainly doesn’t rule on RISC OS… |
GavinWraith (26) 1563 posts |
What does seem to rule on RISC OS is its legacy from BCPL – everything comes down to blocks of bytes or words. OK, pointers maybe. But datatypes, objects, all that fancy stuff? Stick to BASIC as the Good Lord intended! |
Steve Drain (222) 1620 posts |
It has been my ambition for a quarter of a century to combine the two. It really is possible. ;-) |
Steve Pampling (1551) 8172 posts |
ARM BBC Object Basic ? |
Steve Drain (222) 1620 posts |
Hardly. My first was a response to the Toolbox, before I could get hold of a copy without buying the DDE, although the manual was available. It replicated pretty much all the TB did at that time plus the ability to be extended. It was ‘tricky’ and rather ‘heavy’ for the machines at that time and never documented for release. Many years later I was pleased to see parallels to my structures in the Res file structure. Then I developed Basalt and incorporated the TB as an OOP interface. I never got round to implementing the possibility of extending the classes. More recently I wrote Oobi – Object Oriented BASIC Interface. Apart from a handful of assembler ‘codelets’ it is entirely in BASIC, but even ‘trickier’ below the waterline than before. Pleasing, though. ;-) |
Steve Pampling (1551) 8172 posts |
ARM B BC O bject B asic ? Maybe if I did the little quip with emphasis as above? |
GavinWraith (26) 1563 posts |
What I would like to see in the way of a development of BASIC would be a compiler rather than an interpreter, building on the BASIC assembler, and producing ELF files, using the BASIC runtime. As a language I see the basic elements as blocks , either of executable code (functions) or of labelled values (classes). Values would be integers or pointers. Blocks cannot have subblocks. Labels would only exist for the compiler; they would be resoved to addresses by the linker. Local variables in a block would be simply offsets. There would be nil value, representing false , all other values (including 0) representing true . Functions can return multiple values; very necessary for passing error conditions. Strings are of little use unless they can have holes in them; so it is ropes that one wants. These are useful for format strings, which are basically strings with functions embedded which transform values to strings – i.e. format specifiers. The basic building blocks for ropes are of the form
I would prefer that addresses are not explicit in the language. They are something that the compiler and linker know about of which the programmer should remain ignorant. |
David J. Ruck (33) 1636 posts |
The one development BBC BASIC needs is to become fit for the purpose of writing programs for RISC OS. OO would be nice, but first it needs to be able handle in memory structures for things like window blocks with named fields, instead of indirection operators with magic numbers. Secondly it needs proper dynamic memory support, without any nasty hacks. As for interpreted or compiled, I feel interpreted is easier for beginners, and it’s fast enough for most purposes. However there seems to be a number of people that want it compiled, instead of learning a proper compiled language. |
Alan Adams (2486) 1149 posts |
That would be nice. But it would need to be able to deal with things like the return from Wimp_GetWindowInfo, that (from memory) returns a window block offset by 4 bytes, because it starts with the window handle, and consists of a window block followed by a number of icon blocks. |
Pages: 1 2