Although there are possible ways to compile ARM BBC BASIC, it is essentially an interpreted language. The interpreter module is already available on startup with all versions of RISC OS, including the Pi, and any programs can be run in the normal way.SiriusHardware wrote:Sorry if this is a naive question, but can programs written in ARM variants of BBC BASIC be compiled to standalone executables which will run under Pi RISCOS like any other RISCOS utility?
That BASIC was pretty zippy for that machine, even if the best speed had to come from machine code. Likewise, ARM BBC BASIC is fast, and hundreds of very useable desktop applications have been written with it. The built-in ARM assembler can be used for particular speed enhancement.My last exposure to BBC BASIC was on an authentic BBC model B - although it was a lovely implementation of the language it would never have won any awards for speed, and so if you wanted to write anything which ran fast you had to resort to using 6502 assembler (which was a nice feature built into that version).
Do not think compiler. Just write programs and run them. You will not realise they are interpreted until you get into very intensive processing, and then you should probably be using C.-But I've never seen the ARM versions - is there an integral or standalone compiler for those versions?
If you run Jonathan Harston's BASICplus the compatibility with (in particular) BBC BASIC for Windows is greatly improved. Although there are some features he has not yet implemented (notably structures and long strings) many of the BB4W extensions are incorporated, so writing a program that will run on both a Windows PC and a RISC OS machine doesn't mean restricting yourself to "the very simplest level" of BBC BASIC code.Steve Drain wrote:As an afterword, remember that there are other versions of BBC BASIC for many machines - do a search. Programs written with these will only be compatible at the very simplest level.
Of course that is (mostly) true, but it's comparatively rare for it to be important. Commonly the overall speed of a program is determined by its I/O, for example graphics rendering may be the limiting factor, or the speed with which data can be read from a disk. The great majority of the programs I write in BBC BASIC would show no noticeable speed benefit from being converted to machine code.SiriusHardware wrote:code assembled or compiled to executable code should always run faster than the interpreted alternative
Not really, because what you describe is effectively what a compiled language does. More likely is that a Just In Time (dynamic translation) approach will be used: http://en.wikipedia.org/wiki/Just-in-time_compilationthe interpreter could do a single initial pass through the whole source code effectively assembling or compiling it to a ready-to run image in RAM, and then run it. Is that what modern interpreted languages (Like Python) actually do?
Absolutely, and as I said it's in that sense that BBC BASIC for WIndows 'compiles' its executables. They do run faster than when interpreted in the IDE, but not much.I'd prefer any final application written in this (or any other language) to be a single, independently executable file which does not assume the presence of any other resource which may or may not be present on the host.
RISC OS is predicated on shared resources. If you ignore that you are just making trouble for yourself. Start simple, look at some applications, see how things are done. An application is not a single file, but it is, more or less, a self-contained entity. BASIC and C are the common languages to start with and either can do nearly everything you will need at first. Speed is very unlikely to be your main problem.SiriusHardware wrote:I'd prefer any final application ... to be a single, independently executable file which does not assume the presence of any other resource ...
It depends on what you mean by "programming circles". As far as the teaching of programming is concerned, BBC BASIC is recommended by the OCR examining board for their GCSE qualification in computing: Unit A451 Computer Systems and Programming 'may contain questions in a generic pseudocode that looks a lot like BBC BASIC, e.g. BBC BASIC for WINDOWS, or PASCAL' and 'all tasks have been tested in VB.net and BBC BASIC for Windows to make sure they are suitable'.SiriusHardware wrote:I personally cannot understand the apparent loathing with which BASIC appears to be regarded in programming circles
SiriusHardware wrote:The more I read about RISCOS the more I think it's a pity that it was not adopted as the main OS for the Pi from the beginning, as it would have brought the machine much closer to having a single user interface and instantly available programming language right from switch-on.
I personally cannot understand the apparent loathing with which BASIC appears to be regarded in programming circles - I appreciate that Python is very BASIC-Like, and I've spent maybe 10-20 hours writing and debugging Python code, but I just don't feel as instantly comfortable with it as I do with BASIC.
I'm away from my Pi at the moment but I have now decided to give RISCOS and BBC basic a try.
I'd be grateful if you can suggest the most appropriate online tutorial or manual for the BASIC which is bundled with Pi RISCOS, and ditto for the ARM assembler variant / instruction set used by the Pi's processor?
I think I meant that it appears to be a neglected language when it comes to commercial use, where 'C' and derivatives or developments seem to be much more heavily favoured.RichardRussell wrote:
It depends on what you mean by "programming circles". Richard.
Thanks for that!Raeddie wrote:The BASIC manual as PDF: http://foundation.riscos.com/Private/manuals/BASIC/
But so does C (both C and BASIC have a GOTO statement), yet C doesn't tend to attract the same criticism! In both languages it's entirely up to the programmer whether he chooses to write structured code or not. In fact you can argue that C, in providing labels, actually encourages the use of GOTO more so than BBC BASIC, which provides only line numbers as the destination (apart from BBC BASIC for Windows, which does have labels).SiriusHardware wrote:The usual criticism is that it allows the user to write 'Spaghetti' code
I did not say that it was MY criticism. Only that it was a criticism commonly used to dismiss BASIC as an 'unworthy' language. I love BASIC.RichardRussell wrote:But so does C (both C and BASIC have a GOTO statement), yet C doesn't tend to attract the same criticism! In both languages it's entirely up to the programmer whether he chooses to write structured code or not. In fact you can argue that C, in providing labels, actually encourages the use of GOTO more so than BBC BASIC, which provides only line numbers as the destination (apart from BBC BASIC for Windows, which does have labels).SiriusHardware wrote:The usual criticism is that it allows the user to write 'Spaghetti' code
If BBC BASIC programs tend to be less well structured than C programs it's not the fault of the language, it's the fault of the programmers!
Short answer is possibly but with some restrictions.can programs written in ARM variants of BBC BASIC be compiled to standalone executables which will run under Pi RISCOS like any other RISCOS utility?