[Coco] Does a DECB Preprocessor Exist?

Stephen H. Fischer SFischer1 at MindSpring.com
Sat Aug 27 04:25:21 EDT 2005


Hi,

Recently when I was working on a DECB program for the CoCo 3 RGB to S-Video
TV project I could see what I wanted to change, but it would have been way
too much work. Thus I stopped and substituted a poor wheel screen image.
(Actually the second reason I stopped, see other message.)

This has happened to me many times in the past.

Some time later the FLEX Basic Preprocessor popped up in my head.

I liked what I saw as it removed the two most problematical features of
Basic.

Line numbers and two character only variables.

I first thought that the FLEX binary could be run on DECB as the FLEX disk
I/O is about as primitive as the DECB disk I/O. It may not be too hard to do
should anyone be interested.

Then I noticed that "XPC" is both a preprocessor and Basic Compiler all in
one. It still might be useful with DECB using the listing output only and
ignoring the normal output file..

I think that I can rapidly create a DECB preprocessor in "AWK" for
demonstration purposes, the really useful one of course being run under DECB
written in DECB or something more useful.

Before starting can anyone remember anything like this for DECB?

----------------------------------------------------------------------------------

Requirements, just the most important ones for the demo preprocessor.

The output of the preprocessor is an ASCII DECB program that is loaded from
disk just like any other DECB basic ASCII program.

3.1 Variable Names

Variable names may be of any length and may contain letters, numbers, and
the underscore character ('_'). The name cannot be a keyword, the first
character must be a letter or an underscore, and the name must be terminated
by a blank or separator.

$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$ This may not be correct, need to look more    $
$ closely. Not needed for demo version.         $
$                                               $
$ Also the name cannot start with the letters   $
$ 'DEF FN' unless it is a call to or definition $
$ of a USER DEFINED function.                   $
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$

Lower case letters are automatically mapped into upper case, therefore the
name 'lower' is the same as the name 'LOWER'. Some examples of variable
names are:

THIS_IS_A_VARIABLE_NAME
SO_IS_THIS
THIS_IS_A_STRING_VARIABLE$
SO_IS_THIS_$
this_is_too$
THIS_IS_A_DUPLICATE_NAME
this_is_a_duplicate_name


Some illegal variable names are:

1_CANNOT_START_A_VARIABLE_NAME
9CANNOT_START_A_VARIABLE_NAME_EITHER
CLOSE variable names cannot be keywords

The preprocessor will know what the legal two character variable names are
and assign them automatically.
While the demo preprocessor program will not have any method to pre assign
two character variable names, the final one could.



3.2 Line Labels

BASIC normally requires an integer line number on every source line of the
program. XPC, on the other hand, only require a label on a line that program
control will be transferred to. Also, the label need not be an integer, it
can be any contiguous series of characters consisting of letters, numbers
and underscores. Any other character terminates the label name.

All statement labels must begin in column one, and statements must start in
column two or beyond.

Some examples are:

THIS_IS_A_LABEL REM THIS IS A REMARK STATEMENT WITH A LABEL
1000_ _ REM THAT WAS THE LABEL '1000'
THIS_IS_A_LABEL_WITHOUT_A_STATEMENT
0000 REM NOTE THAT 0000 IS A LEGAL LABEL NAME
 GOTO 0000 \REM IS A VALID STATEMENT; BUT
 GOTOOOOO \REM DEFINES A VARIABLE 'GOT00000'

Additional requirements, for Quick Temp Preprocessor.

Additional blanks must be present separating keywords, Variables and special
characters.

This will allow each input line to be separated automatically by "AWK".

Numeric labels are not allowed.

Other undefined restrictions to make the temp version be easy to code.

Stephen H. Fischer





More information about the Coco mailing list