FOCALFREE is a utility for translating from a FOCAL free context grammar to
a fix formated FOCAL grammar.

(FOCAL means "Forty one calculator language") 


This utility needs the VFP5 runtime.


Usage: FOCALFREE inputfile outputfile


Example: FOCALFREE TEST00.PRG TEST01.PRG


In a  FOCAL free context grammar it's allowed to write programs as:


TEST00.PRG:
--------------------------
LBL   "ADD10"
  1   STO 00
  0   STO 01
LBL   00
      RCL 01 RCL 00 + STO 01
      1 ST+ 00
      10 RCL 00 X<=Y?
GTO   00
RCL   01
END
--------------------------
Also you could write the program in this way:

TEST00.PRG:
------------------------------------------------------------------------
LBL   "ADD10"  1  STO  00  0   STO  01   LBL  00  RCL 01  RCL 00 + STO
01 1 ST+ 00 10  RCL 00    X<=Y?  GTO       00     RCL   01  END
------------------------------------------------------------------------
Note that you can use more than one space between the words. Also, note
that in the first row you begin a STO command and the parameter "01" for
this instruction is in the following row. Then it is possible to split a
command in two rows.


The command: FOCALFREE TEST00.PRG TEST01.PRG

does a translation from TEST00.PRG into TEST01.PRG

Output file: 

TEST01.PRG:
--------------------------
LBL "ADD10"       
1                   
STO 00              
0                   
STO 01              
LBL 00              
RCL 01              
RCL 00              
+                   
STO 01              
1                   
ST+ 00              
10                  
RCL 00
X<=Y?
GTO 00              
RCL 01
END
--------------------------

Example 2:

To Translate my program 8QUEENS from free FOCAL format to fixed format:

FOCALFREE FREE8Q.PRG FIXED8Q.PRG

Please view the program FREE8Q.prg provided with this utility



Notes:


1. The maximum width in the input text file is 254 characters.
2. The program must be written in uppercase.
3. The input file is searched for TOKENS. (A TOKEN is a set of consecutive characters
   without inner spaces)
4. The TOKENS are written to the output file one by each line 
5. FOCALFREE splits the original text and add a line in the output file with the current
   token if a space is found after this token.
6. If a text is between " " , FOCALFREE does not split the text when it finds inner spaces.
7. Empty lines in the original file are deleted.
8. Several consecutive spaces are converted to a space alone. If the spaces are within
   text surrounded by " " several spaces are not converted to one space.
9. Spaces beginning a line are deleted
10. Empty lines are skiped
11. This version of FOCALFREE (Version 1.1) does not split text if a space is found after:
       "IND"
       "ASTO"
       "ARCL"
       "CF"
       "DSE"
       "ENG"
       "FIX"
       "FC?C"
       "FC?"
       "FS?S"
       "FS?"
       "GTO"
       "LBL"
       "ISG"
       "SCI"
       "SF"
       "STO"
       "ST+"
       "ST-"
       "ST*"
       "ST/"
       "RCL"
       "SREG" 
       "TONE"
       "X<> "
       "XEQ"
       "VIEW"

12. If the output file has not a extension the extension will be .TXT
    Example FOCALFREE ONE TWO creates the file TWO.TXT
13. FOCALFREE is FREEWARE
14. Use this program at your own risk. I am not responsible by the use that you can
    give to this program.


HISTORY:


Version 1.2
-----------

Included the ability for add comments within the Free Context Grammar.
It is possible using // 

Example:

// Program number 1 
// Date: 2004/11/26
// Goal: To calculate 1+2+3+4+5+6+7+8+9+10

LBL "ADD10"

// This is a comment
1 STO 00  //Comment2
0 STO 01
LBL   00// This is another comment
      RCL 01 RCL 00 + STO 01//comment
      1 ST+ 00  // Other comment
      10 RCL 00  X<=Y?
GTO   00
RCL 01
END

Notes:

1. The comments are not included into the output file.
2. All text at right of // is ignored
3. The // is ignored too.



Version 1.1
-----------


Fixed a problem with spaces before IND. (Version 1 put 3 spaces between the
previous TOKEN and IND)
Included the new example file: FREE8Q.PRG and his translation FIXED8Q.PRG
If you don't enter parameters the error message is replaced by "Invalid Parameters"
The translation is made in two passes. You could look at the output of first
pass viewing the intermediate file PASS1.TXT



Written by Alvaro Gerardo Surez.
http://www.geocities.com/algesuar
e-mail: algesuar@yahoo.com
