[Coco] The Coco's first webserver, written in Basic09

Wayne Campbell asa.rand at gmail.com
Thu Dec 31 20:12:32 EST 2009


I understand what you are saying. It sounds like you want to do with Basic09 what any other browser would do with javascript, vbscript or some other scripting language. If Basic09 were a scripting language that would work, but it isn't. And it isn't like php or coldfusion, where you can generate code on the fly and execute it.

Basic09 is not strictly an interpreter. The only interpreting it does is with the tokens that it creates. The tokens are not stored in the source file. They are compiled into a form suitable for processing (RPN notation). Packing removes all references to labeling, which makes the code more compact.

The Basic09 programming language is divided into 2 parts, the development environment (Basic09) and the real-time execution environment (RunB).

The differences between the 2 are significant. Basic09 includes a command mode, which allows you to use the edit and debug modes. It also includes the execution mode, and that is written in such a way that it can execute the code compiled by loading source code, and code that has been packed. This is what makes it possible to have a debugging capability within Basic09. While you can pass an argument to Basic09 when you launch it, that argument is restricted to the procedure (packed or not) to be executed, and any parameters it is expecting. If the procedure is packed I-Code, Basic09 will load it and execute it, with all output generated going to the screen, but the screen is Basic09's, which means all output is going to it's "command window", not standard out. You cannot redirect output from within Basic09 using the > modifier. I believe that using a source-file as the argument will load and execute, but it may only load. I need to do some testing there to see. There is no option for "load and pack" that I am aware of. You have to be at the B: prompt, and type the command 'pack <procedure>'. If no procedure is specified, the current procedure (marked by the * in the procedure list) is used as the target to pack. <procedure> can be a list of procedures, and the syntax for that is 'pack* <filename>'.

RunB accepts the same kind of argument, but lacking the command aspect, all output is being sent to stdout, which means you can redirect output. RunB only contains the execution mode, and will not execute code that has not been packed, nor will it pack code. Neither Basic09 nor RunB evaluates a text string and then interprtets it. All "interpretation" is done when the source file is read upon load. All source statements are replaced with tokens and pointers to lists that contain the various references. Literals are kept "as is", and placed in the instruction section as they occur. Your TYPE, DIM and PARAM statements no longer exist. Everything relating to variable reference identification is contained in the VDT, DSAT and relative to the procedure's data storage requirements.

This is why I said that what you wanted to do, as I understand it, is the same as launching Visual Studio everytime you generate a new C++ source file. It would work much better to write a procedure that takes the html you generate and use it when and where you want it.

Wayne


----- Original Message ----- 
From: "Christian Lesage" <hyperfrog at gmail.com>
To: "CoCoList for Color Computer Enthusiasts" <coco at maltedmedia.com>
Sent: Thursday, December 31, 2009 6:40 AM
Subject: Re: [Coco] The Coco's first webserver, written in Basic09


> Wayne Campbell wrote:
>> If I am understanding you correctly, the idea is you are generating 
>> this code, then converting it to Basic09. 
> Yes. First, you author some HTML code using any standard web page 
> editor. You may include BASIC09 code, provided it is enclosed within <% 
> and %>, so that your page is an active one. Second, you convert this 
> HTML file to a BASIC09 procedure using an automated tool. Third, you 
> compile (pack) the resulting procedure into I-code so that it can be run 
> efficiently on the CoCo.
> 
>> I assume the content could be different with each run, so you would be 
>> repacking this continually. 
> No. There's something you don't understand. The HTML content delivered 
> to the client could be different on each run (it depends on whether you 
> authored a passive page or included some BASIC09 into it ), but the code 
> generating this HTML content on the server would remain the same. AFAIK, 
> this is how every active server works. This is even how the first 
> version of Aaron's server was working (i.e. same code, different result 
> every time you visit the page).
> 
>> However, if this is a compile once-run many times thing, 
> Yes, it is.
> 
>> then why not just write the Basic09 procedure as a procedure and pack it?
> 
> Because you may want to create your web pages using standard visual web 
> authoring tools instead of writing BASIC09 code using a text editor. 
> Well, if you don't, I would.
> 
> 
> 
> --
> Coco mailing list
> Coco at maltedmedia.com
> http://five.pairlist.net/mailman/listinfo/coco


More information about the Coco mailing list