What would AArch64 BASIC look like?
GavinWraith (26) 1563 posts |
There was a book that I found really interesting, containing a commented disassembly of BASIC on the BBC B microcomputer. I think there were two authors but I cannot remember the name(s). It was published by the same press that brought out other books and manuals for Acorn. I am sure it contained more about BASIC than the user guides. Sorry about the poor memory. |
James Byrne (3371) 29 posts |
If you want a more comprehensible and accurate summary of all the things that have changed in BBC BASIC over the years, I would recommend reading Appendix I of the BBC BASIC Reference Manual (Issue 2, October 2017). Many, many hours of time was spent sorting through everything that’s changed to make this as accurate as possible, and individual keywords in the manual also have sections noting which versions introduced changes. |
Stuart Swales (1481) 351 posts |
Sadly the 32016 BBC BASIC manual over on Chris’ Acorns (http://chrisacorns.computinghistory.org.uk/docs/Acorn/Sci/AcornScientific_BBCBASICRM.pdf) is borked. That one would have been somewhere between the Master and Archimedes in functionality. I don’t think it was supposed to see the light of day, Cambridge Workstation trying to be all professional, but we got the MoD interested somehow (used for choosing sites for Rapiers in the Falklands) Anyone else remember the error: “BASIC tried to die, but Tiny Kernel wouldn’t let it” |
Chris Hall (132) 3554 posts |
Versions between 1.19 and 1.34 differed between the Select fork and RISC OS 5 but after version 1.34 (Select 4) the RISC OS 5 version is the definitive one. Appendix I neatly sidesteps that. |
Andy Vawer (5817) 28 posts |
This link seems to work for the 32016 BBC BASIC manual: https://acorn.huininga.nl/pub/docs/manuals/Acorn/32016%20Second%20Processor/AcornScientific_BBCBASICRM.pdf |
Stuart Swales (1481) 351 posts |
Thanks for digging that out. Looks like this was the first one with CALL (MOS routine) emulation. I wonder whether the changes made to BASIC for the hard-float variant (Bas32f?) were ever documented? |
David Feugey (2125) 2709 posts |
This website is a very good source of informations :) |
jan de boer (472) 78 posts |
re Basic specification: the book ‘BASIC ROM user guide’ by Mark Plumbley contains a Backus-Naur syntax definition (p.319). Moreover, it details ROM routines for the various BASIC routines, BASIC stack, expression evaluation etc. etc. for 6502 BASIC. It’s available as one of the 55 books on one DVD from www.dragdrop.co.uk. Whether it’s a specification by way of afterthought or not, does not matter: it elucidates perfectly the inner workings of BASIC, and anyway you have to add the newer commands yourself and devise some statemachine to process (the levels of) multiline statements like REPEAT, WHILE. The various newer BASIC manuals could be used to reverse-engineer things; especially the CALL statement for memory organisation. All ‘imho’. |
Steve Drain (222) 1620 posts |
Thanks. I knew I had seen that, but among more than 30 books of the period I do not have that one. I have bought the CD, so it will be interesting to look at. As an aside, while rummaging through the books I came across the BASIC Extensions ROM. The program structure enhancements had some features that were never included in ARM BASIC. |
Steve Drain (222) 1620 posts |
There is a fair amount of reverse engineering in my BASIC StrongHelp manual, and even more within Basalt. ;-) |
James Byrne (3371) 29 posts |
That’s a good point, although I’m not sure whether there’s any information available about what changed in the Select fork. Were there any notable changes to BASIC? I’ve done a bit of Googling but can’t find anything. |
Steve Drain (222) 1620 posts |
I was intrigued by this, so did some studying. Taken as it stands it does not really comply with BNF, and even if it did, it does have quite a few typing errors. Well, that set a challenge to do better, but I did not realise what I was letting myself in for. The result is a definition of the grammar of BASIC V as in the latest manual. It is quite extensive, even without dealing with assembler. ;-) I have chosen to use ISO Extended Backus-Naur Form (EBNF), and so that I could check it I have also written a generator to convert the syntax to a parser, and a test program to use the parser. All that is at http://www.kappa.me.uk/Miscellaneous/swParser010.zip. I still have to extend it to take a BASIC text file and check it as a whole, but I would be interested in comments from those who can understand what I have done so far. Whatever, it has been like tackling a giant prize crossword, and very entertaining. |
Jeffrey Lee (213) 6048 posts |
Nice work! Now you have the fun of playing spot the difference between the spec/manual and reality ;-) E.g. “ |
Steve Drain (222) 1620 posts |
There is quite a bit of juggling going on already, but your example has caught me. The most head-scratching I had was over how PROC/FN names with @ and keywords in them work, although that is commented out for the time being, because all keywords have to be checked. I more or less gave up with PRINT. ;-) Do let me know of any more. |
Julie Stamp (8365) 474 posts |
Brilliant! |
Julie Stamp (8365) 474 posts |
Steve, could you give a short example or two of how to use Files.Test? |
Rick Murray (539) 13840 posts |
Either I’m using it wrongly, or it is broken? When asked for a symbol to test, I entered “num-exp”. At this point, entering random four letter words best not reproduced here, also reported “Passed as XXXX” so… um…? Doing it the other way around (symbol = FOR, definition some code with a FOR in it) reports a problem with the symbol. Always. |
Steve Drain (222) 1620 posts |
You have not noted my comment above that keyword checking in names is commented out. So DRAW END etc are recognised as valid variable names. If you really want to, go to the Syntax file Identities section and comment out the ‘simple’ line and uncomment the ‘tricky’ lines, Generate the Parser and then try the keywords again. Let me know how you get on. The Parser will have very big FNs checking for each of the keywords in turn. ;) The Parser and Test are quite elementary and not of end-user grade. They will not stand much stress. |
Julie Stamp (8365) 474 posts |
As far as I can see, one cannot actually make a parser from only EBNF, because that just tells you whether something has the right syntax. I was looking at the example of
which Rick points out ABC gets wrong. There must be some extra information to plug in because the EBNF doesn’t distinguish between the two interpretations. |
Steve Drain (222) 1620 posts |
Rick has just supplied an example, but here is another. First open the BASIC manual at ‘COLOUR’, because you will need it for all the possible parameter combinations. At the ‘Symbol to test ?’ prompt input ‘colour-s’ to test the COLOUR statement. At the ‘Test definition ?’ prompt input ‘COLOUR 1’ the simplest statement. Continue to input ‘COLOUR’ with combinations of parameters with OF ON TINT etc. Let me know if you find a valid combination that does not pass. ;-) Note that the Syntax is not complete, particularly FNs are not dealt with in expressions. |
Julie Stamp (8365) 474 posts |
Symbol |
Rick Murray (539) 13840 posts |
How about invalid combinations that pass? Symbol to test ?colour-s Test definition ?COLOUR NEXT FOR END 2020 IS A CRAP YEAR I WANT MY MOMMY WAAAAH Passed as COLOUR NEXT Test definition ?COLOUR COLOUR Passed as COLOUR COLOUR Test definition ?COLOR 1 Failed in COLOR 1 Hmmm, thus it passes obvious crap that BASIC would reject (statements cannot be assigned as variables!) and faults the American misspelling that BASIC accepts (as is noted in your own StrongHelp manual ;-) ). |
Steve Drain (222) 1620 posts |
Very true. My use of the term Parser is misleading.
Yes. That is “all” it does.
It does not get it ‘wrong’. That is what the ABC dialect does and it is documented. The
No, because it is valid ARM BASIC. |
Steve Drain (222) 1620 posts |
I will check that, but it may be one of the hanging bits, because I have not done the ‘line’ and ‘program’ properly yet, if ever. |
Steve Drain (222) 1620 posts |
Did you do the changes to check keywords in variables? If not, then those keywords are valid expressions. Test definition ?COLOUR NEXT FOR END 2020 IS A CRAP YEAR I WANT MY MOMMY WAAAAH Passed as COLOUR NEXT This is quite correct. Edit: more importantly, parameters are comma-separated, so everything after NEXT is invalid. If you were building a true Parser you would deal with Test definition ?COLOR 1 Failed in COLOR 1 I pondered whether to deal with |