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

Christian Lesage hyperfrog at gmail.com
Thu Dec 31 21:18:52 EST 2009


I am *not* trying to generate BASIC09 code on the fly, and I am *not* 
trying to evaluate and execute any text string containing BASIC09 code. 
If this is what you you think, then you didn't understand my 
explanations. All the generated BASIC09 code would be *packed* prior to 
execution, just like Aaron's server is. It doesn't mean it cannot 
generate HTML code on the fly. That said, I will not attempt to explain 
once again the system I am thinking about, because there is nothing I 
could do to explain it better than I've already done. Sorry.


Wayne Campbell wrote:
> 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 op
>  tion 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
>   





More information about the Coco mailing list