home *** CD-ROM | disk | FTP | other *** search
- BSLP Version 1.0B Page 1.0
-
- Table of Contents
-
- BSLP: Basic Structured Language Preprocessor......... 1.1
- Functions...................................... 1.1
- Invocation..................................... 1.1
- Defaults....................................... 1.1
- Option (/)..................................... 1.1
- Structure Keywords............................. 1.1
- PROG / PEND............................... 1.2
- PROC / ENDP............................... 1.2
- REPEAT / UNTIL............................ 1.3
- LOOP / ENDL............................... 1.3
- WHEN / ELSE / ENDW........................ 1.4
- UNLESS / ENDU............................. 1.4
- SWITCH / CASE / BREAK / ENDC.............. 1.5
- Error Messages................................. 2.1
- Structure Related Error Handling.......... 2.1
- Structure Related Error Messages.......... 2.1
- Included Files (+-)............................ 3.1
-
- Notice:
- Delimiter conventions used in this documentation
- are:
- <> denotes required information
- [] denotes optional information
-
-
-
-
-
-
- BSLP Version 1.0B Page 1.1
-
- BSLP - Basic Structured Language Preprocessor
-
-
-
- Function:
-
- BSLP translates source text written in BSLP structure
- language to standard BASIC code. BSLP is a BASIC language
- version of the PPE structure translater. It is slow but very
- usable, and has served well as a tool for prototype
- extensions to the structure language. BSLP is written in BSLP
- structure language and should be a useful learning tool.
-
-
- Invocation:
-
- Entering 'BSLP' at the DOS prompt will envoke the compiled
- version (.EXE) of BSLP. The (.BAS) version will have to be
- run using the interpreter by entering 'BASICA BSLP' at the
- DOS prompt. BSLP will then prompt for the input file name and
- the output file name. The default for the input file
- extension is '.P', and the default for the output file
- extension is '.BAS'. The slash (/) following the input file
- name will cause all non-referenced line numbers to be deleted
- from the output file (.BAS). This allows a smaller compiled
- (.EXE) program.
-
-
- Hints and Restrictions:
-
- Structure keywords are not case or position sensitive, and
- they must (except for spaces and tabs) be the first words on
- a line. Do NOT use comments on the same line with keywords.
- The vertical bar (|) may be use to provide line continuation.
- Continued lines will be appended, separating them with a
- colon (:).
-
-
- Structure Keywords:
-
- PROG / PEND
-
- PROC <label> / ENDP
-
- REPEAT / UNTIL <condition>
-
- LOOP [<when/unless> <condition>] / ENDL [<when/unless> <condition>]
-
- WHEN <condition> / ELSE [<when/unless> <condition>] / ENDW
-
- UNLESS <condition> / ENDU
-
- SWITCH <left operand> / CASE <right operand> / BREAK / ENDC
-
-
-
-
-
- BSLP - Basic Structured Language Preprocessor Page 1.1
-
-
-
- BSLP Version 1.0B Page 1.2
-
- Structure Keyword Definitions and Usage:
-
- PROG / PEND
-
- 'PROG' identifies the main controlling procedure in a
- program. 'PEND' identifies the end of the main procedure and
- causes an "END" BASIC keyword to be generated.
-
- Usage:
-
- PROG Calculate <----------+
- gosub process_one | Main
- gosub process_two | Procedure
- PEND <----------+
-
-
- PROC <label> / ENDP
-
- 'PROC' defines the beginning of a procedure subroutine using
- a label that may be referenced by name (e.g. 'GOSUB label')
- from any other procedure in the same program. 'ENDP' closes
- the matching 'PROC' and terminates the procedure with a
- "RETURN" BASIC keyword. Procedures can not be nested.
-
- Usage:
-
- PROC Test_Out <----------+
- when status = test | Subroutine
- gosub test_it | Procedure
- endw |
- ENDP <----------+
-
- *Note:
- A label-name immediately followed by a colon (:) may be used
- to identify a label without a procedure statement:
-
- e.g... ERRORTRAP:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Structure Keyword Definitions and Usage Page 1.2
-
-
-
- BSLP Version 1.0B Page 1.3
-
- REPEAT / UNTIL <condition>
-
- 'REPEAT' defines the top of a conditional loop structure. The
- matching 'UNTIL' defines the bottom of the loop where the
- terminating condition is tested. The loop is terminated when
- the condition evaluates true.
-
- Usage:
-
- REPEAT <----------+
- index = index + 1 | Loop
- gosub Index_task | Structure
- UNTIL index = task.count <condition-+
-
-
- LOOP [<when/unless> <condition>] / ENDL [<when/unless> <condition>]
-
- 'LOOP' defines the top of a loop structure that will allow a
- condition to be tested at the top and or at the bottom
- matching 'ENDL'. At the top 'WHEN' evaluates for a true
- condition to continue into the loop structure, and 'UNLESS'
- evaluates for a true condition to branch around the loop. At
- the bottom 'WHEN' evaluates for a true condition to exit the
- loop, and 'UNLESS' evaluates for a true condition to continue
- the loop. One condition (top or bottom) is required, but both
- may be use.
-
- Usage:
-
- LOOP <----------+
- index = index + 1 | Loop
- gosub Index_task | Structure
- ENDL unless index < task <condition-+
-
- LOOP when index < task <condition-+
- index = index + 1 | Loop
- gosub Index_task | Structure
- ENDL <----------+
-
- LOOP unless index >= task <condition-+
- index = index + 1 | Loop
- gosub Index_task | Structure
- ENDL when index >= task <condition-+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Structure Keyword Definitions and Usage Page 1.3
-
-
-
- BSLP Version 1.0B Page 1.4
-
- WHEN <condition> / ELSE [<when/unless> <condition>] / ENDW
-
- 'WHEN-ELSE-ENDW' provides for multiple line conditional
- constructs, with no limit on the range or depth of level and
- no limit on the number of 'ELSE' statements used. 'ELSE WHEN'
- defines the "ELSE-IF" construct, and 'ELSE UNLESS' defines
- the "ELSE-IF-NOT" construct. 'ENDW' closes the matching
- 'WHEN' and terminates to the next outer level of processing.
-
- Usage:
-
- WHEN method = manual IF
- goSub Keyboard THEN
- ELSE WHEN method = auto ELSE IF
- goSub Process THEN
- ELSE UNLESS method = null ELSE IF NOT
- goSub Process_End THEN
- ELSE ELSE
- goSub End_Process THEN
- ENDW
-
-
- UNLESS <condition> / ENDU
-
- 'UNLESS' defines a "DO WHEN NOT TRUE" construct and 'ENDU'
- closes the matching 'UNLESS' and terminates to the next outer
- level of processing.
-
- Usage:
-
- UNLESS abort = true IF NOT
- gosub Continue THEN
- ENDU
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Structure Keyword Definitions and Usage Page 1.4
-
-
-
- BSLP Version 1.0B Page 1.5
-
- SWITCH <left operand> / CASE <right operand> / BREAK / ENDC
-
- 'SWITCH-CASE-ENDC' provides an "ON CONDITION PROCESS"
- construct. 'SWITCH' defines the operand on the left side of
- the equal sign and 'CASE' defines the operand on the right
- side. There is no limit on the number of 'CASE' statements
- within a procedure. When a 'SWITCH=CASE' is true, the
- instructions following that 'CASE' are processed, and unless
- a 'BREAK' statement is used, processing will continue through
- to the next 'CASE' statement. The 'BREAK' statement will
- cause a branch to the next 'ENDC' statement. The 'BREAK' will
- be processed only if a 'SWITCH=CASE' is true. When a
- 'SWITCH=CASE' evaluates false, processing is branched to the
- next 'CASE' statement. 'SWITCH' statements can be nested to
- ten (10) levels. 'ENDC' closes the matching 'SWITCH' and
- terminates to the next outer level of processing.
-
- Usage:
-
- SWITCH method$(method)
- CASE "+"
- answer = answer + number
- BREAK
- CASE "-"
- answer = answer - number
- BREAK
- CASE "*"
- answer = answer * number
- BREAK
- CASE "/"
- when number <> 0
- answer = answer / number
- else
- answer = 0
- endw
- ENDC
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Structure Keyword Definitions and Usage Page 1.5
-
-
-
- BSLP Version 1.0B Page 2.1
-
- Structure Related Error Handling:
-
- When a structure error is encountered, a file
- (<program-name>.E) is generated, showing the exact location
- of the error. All structure errors are resolved at the end of
- each procedure, or 'ENDP'. When there are errors immediately
- following an 'ENDP' statement, the procedure preceding the
- 'ENDP' statement will be the source of the errors.
-
- Structure Related Error Messages:
-
- Structure related error messages are displayed with a 'ERR#'
- and the error count. These errors will be recorded in the
- error file (<program-name>.E).
-
- Structure related error messages are self explanatory, the
- following are some typical examples:
-
- ERR#1 MISSING (endl) PROC <BEGIN>
- (A 'LOOP' structure not closed in procedure BEGIN)
- ERR#1 MISSING (switch) PROC <Select>
- (A 'CASE' or 'BREAK' or 'ENDC' without an opening
- 'SWITCH' in procedure Select.)
- ERR#1 MISSING (endc) PROC <>
- (A 'CASE' structure not closed in main procedure.)
- ERR#1 MISSING (include 'filename')
- (Unable to find an included file.)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Errors Page 2.1
-
-
-
- BSLP Version 1.0B Page 3.1
-
- Included Files:
-
- There are two methods to include additional files into a
- program source file for processing:
-
- Immediate:
- +filename.ext
-
- The leading plus (+) will cause a file to be included
- immediately into the program source file and processed. The
- same file or any number of files may be included and
- processed.
-
- Stacked:
- -filename.ext
-
- The leading dash (-) will cause a file name to be stored and
- the file will be included only one time at the end of the
- main program source file. The same file name may be
- referenced many times, with the file included into the
- program source file only one time and processed. The internal
- file name storage will hold up to fifty (50) file names.
-
- *Note:
-
- Nested includes may be processed up to five (5) levels deep.
- Nesting is limited by the number of files that can be open at
- the same time. No line numbered include files allowed.
-
-
-
- WARNING:
-
- A recursive include will blow the internal stack. No check is
- made for recursive includes.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Including Files Page 3.1