{"id":468,"date":"2016-03-11T10:42:33","date_gmt":"2016-03-11T09:42:33","guid":{"rendered":"http:\/\/www.hunggartorino.it\/ql\/?p=468"},"modified":"2016-03-11T12:16:45","modified_gmt":"2016-03-11T11:16:45","slug":"ssb-a-new-way-for-superbasic-programming","status":"publish","type":"post","link":"http:\/\/www.hunggartorino.it\/ql\/ssb-a-new-way-for-superbasic-programming\/","title":{"rendered":"SSB &#8211; a new way for SuperBASIC programming"},"content":{"rendered":"<p>&nbsp;<\/p>\n<p>SuperBASIC, as we all know, is one of the most powerful programming languages available for the QL: being extensible almost indefinitely, and with its ability to add commands and functions, SuperBASIC not only allows having a programming language always up to date with the current needs of a developer, but also offers an environment tailored to the single developer&#8217;s needs, without having to keep in memory countless libraries.<br \/>\nThis offers multiple opportunities in language extensions and integration, but from another point of view we can see how SuperBASIC lacks in development environment.<\/p>\n<p>SuperBASIC doesn&#8217;t offer an editor worth of the name. ED is good for little, tiny programs: producing a professional, high-performance software with this tool creates big problems both in developing and maintenance. ED allows working on a single file at a time, doesn&#8217;t have a clipboard facility nor a search function, and lacks other functions which are important to a developer. SuperBASIC has its problems too: it forces the programmer to use line numbers &#8211; thus making it impossible to use a normal text editor, unless the programmer writes all the line numbers by himself; another problem is that SuperBASIC doesn&#8217;t allow writing sentences on more than one line, making it really difficult to write complex IF-THEN constructs with more than two or three operands.<\/p>\n<p>It&#8217;s impossible, other than this, to automatically insert parts of a program source or external routines into the source we&#8217;re working with: this because compilers don&#8217;t support the MERGE command. Even so, developers must pay close attention to line numbers, lest they lose entire lines of code.<\/p>\n<p>The last problem comes as a surprise from Q_Liberator, the excellent compiler which almost all we know. In order to support the $$ directives, the compiler keeps every comment written into the compiled object file, thus creating a huge file without real reason &#8211; or otherwise forcing the poor developer to manually delete every comment, or even worse writing a source file totally undocumented (making it really hard to maintain it).<\/p>\n<p>All of this contributes to consider SuperBASIC with a certain suspicion by those who try to write software of a certain quality.<br \/>\nA solution to these problems comes from the USA thanks to Tim Swenson, with his SSB package (currently at release 2.7.1). But what exactly is SSB?<\/p>\n<p>SSB is a &#8220;language translator&#8221;: it is able to translate in SuperBASIC a source file written in the &#8220;Structured SuperBASIC&#8221; (SSB) format.<br \/>\nSSB is not a new language: it&#8217;s a different way to write SuperBASIC software, much more versatile and much less strict in following the rules. SSB will take care of translating the written source in a SuperBASIC source.<\/p>\n<p>Let&#8217;s take a little overview in this different way of writing. For starters, SSB code can be written in a common ASCII plain text file, so an SSB source can be wrote or edited with any text editor. Other than that, line numbers are no more: SSB will take care of adding them while translating.<br \/>\nIt is possible to insert empty lines (which will be deleted during translation) in order to make the program more human-readable.<br \/>\nThe comments are inserted using the ## sequence, and SSB will remove them during SuperBASIC translation in order to make the source as light as possible.<br \/>\nIf we use ** instead of ##, the comment will be kept (for example, to support the $$ directive).<\/p>\n<p>As an example, let&#8217;s compare the following two sources. What follows is what we would write in SuperBASIC:<\/p>\n<p>100 REMark +- Demo source 1 &#8212;&#8212;&#8212;&#8212;+<br \/>\n110 :<br \/>\n120 FOR CYCLE = 1 TO 10<br \/>\n130 PRINT CYCLE<br \/>\n140 END FOR CYCLE<br \/>\n150 :<br \/>\n160 PRINT &#8220;END OF PROCESSING&#8221;<\/p>\n<p>this in SSB becomes:<\/p>\n<p>## +- Demo source 1 &#8212;&#8212;&#8212;&#8212;+<\/p>\n<p>FOR CYCLE = 1 TO 10<br \/>\nPRINT CYCLE<br \/>\nEND FOR CYCLE<\/p>\n<p>PRINT &#8220;END OF PROCESSING&#8221;<\/p>\n<p>SSB changes also the way one works: common routines can be written into separate files and merged to the main source file with the #incluse directive, so that if a routine changes it&#8217;s not necessary to rewrite that routine in all the sources: it&#8217;s just a matter of recompiling the code, because SSB will take the task of automatically update the routine itself.<br \/>\nIt is possible to perform conditional compilations: some instruction blocks will be inserted into or excluded from the code by using a switch. This is of course an extremely useful option to automate the creation of demo versions of a program, enabling or disabling debugging features, or adding\/excluding particular options avoiding to have many different copies of a source (all of them needing maintenance).<br \/>\nIt is possible to separate lines using the &#8220;\\&#8221; character, such that the source is more easily readable. For example, the SuperBASIC instruction<\/p>\n<p>100 IF COMODO1 = &#8220;PIPPO&#8221; AND COMODO2 = &#8220;PLUTO&#8221;<\/p>\n<p>in SSB becomes:<\/p>\n<p>IF\u00a0 \u00a0 COMODO1 = &#8220;PIPPO&#8221; \\<br \/>\nAND COMODO2 = &#8220;PLUTO&#8221;<\/p>\n<p>Of course the &#8220;\\&#8221; sequence doesn&#8217;t count as a directive if it&#8217;s contained into a string.<\/p>\n<p>SSB supports also GOTO and GOSUB via an useful and really easy to understand labelling system.<\/p>\n<p>This project is constantly updated, and upgrades can be found in our Internet site, in the &#8220;Warehouse&#8221; section.<\/p>\n","protected":false},"excerpt":{"rendered":"&nbsp; SuperBASIC, as we all know, is one of the most powerful programming languages available for the QL: being extensible almost indefinitely, and \n<a class=\"moretag\" href=\"http:\/\/www.hunggartorino.it\/ql\/ssb-a-new-way-for-superbasic-programming\/\"> [..more...]<\/a>","protected":false},"author":1,"featured_media":473,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[43],"tags":[],"class_list":["post-468","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-programming"],"_links":{"self":[{"href":"http:\/\/www.hunggartorino.it\/ql\/wp-json\/wp\/v2\/posts\/468","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.hunggartorino.it\/ql\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.hunggartorino.it\/ql\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.hunggartorino.it\/ql\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.hunggartorino.it\/ql\/wp-json\/wp\/v2\/comments?post=468"}],"version-history":[{"count":5,"href":"http:\/\/www.hunggartorino.it\/ql\/wp-json\/wp\/v2\/posts\/468\/revisions"}],"predecessor-version":[{"id":476,"href":"http:\/\/www.hunggartorino.it\/ql\/wp-json\/wp\/v2\/posts\/468\/revisions\/476"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.hunggartorino.it\/ql\/wp-json\/wp\/v2\/media\/473"}],"wp:attachment":[{"href":"http:\/\/www.hunggartorino.it\/ql\/wp-json\/wp\/v2\/media?parent=468"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.hunggartorino.it\/ql\/wp-json\/wp\/v2\/categories?post=468"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.hunggartorino.it\/ql\/wp-json\/wp\/v2\/tags?post=468"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}