BC:Main Page
From All Basic
Contents |
[edit] BaCon
BaCon is a simple BASIC implementation which translates into C-code. The C-code can be compiled with GCC (GNU C Compiler) or TCC (Tiny C Compiler).
BaCon does not need linenumbers. One statement per line is accepted. If there are more statements on the same line then these are ignored.
BACON consists of statements, functions and expressions. Each line should begin with a statement. Functions always return a value to a variable or statement (like PRINT) but also can be used standalone. Expressions are not converted but are passed unchanged to the C compiler.
There are two variable types in BaCon: numeric and string. Variables will be declared implicitely from the first moment a variable is used. If a variablename ends with the '$' symbol, a string variable is assumed. Otherwise it is regarded as numeric. By default, BACON assumes INTEGER type with numeric variables. With the 'DECLARE' statement it is possible to define a variable to any other C-type explicitely.
The three maintypes in BACON are defined as STRING, INTEGER and FLOATING.
Subroutines may be defined using SUB/ENDSUB. These SUB routines do not return a value. With FUNCTON/ENDFUNCTION routines can be defined which do return a value. The returnvalue must be explicitely stated with the statement RETURN.
Variables which are used and declared within a SUB or FUNCTION have a local scope, meaning that they are not seen by the mainprogram or other routines.
The statements and functions in Bacon also can be written in lowercase.
Peter van Eerten - BACON HOME PAGE
Gtk-Server - by the same author that created BaCon.
[edit] Project Goals
Bacon is an experimental BASIC to C converter. The following design goals were followed:
- Must run on each Unix/Linux/BSD platform, also MacOSX
- Converted source code must be compilable with GCC
- Must resemble genuine BASIC with implicit variable declarations
- Spoken language constructs are preferred
BaCon is based on Kornshell, which can be found on practically each Unix platform. If Kornshell is not available on your platform, download and install Public Domain Kornshell. BaCon also works with the standard KornShell's KSH88 and KSH93.
[edit] News
Changes - Current Release Notes
[edit] Documentation
- STATEMENTS
- NUMERIC FUNCTIONS
- DATE/TIME
- STRING FUNCTIONS
- RUNTIME ERROR HANDLING
- EXTERNAL INTERFACE
- SYSTEM VARIABLES
Note: All GCC compliant math operators are accepted.
[edit] Download
[edit] Demo programs
- Base64 encoder here
- Base64 decoder here
- The Zeller algorithm here
- UTF8 encoder here
- Simple calculator program here
- GTK direct here
- Curses program here
- GTK-server/Glade and Glade direct here
- Brainfuck interpreter here
- Respace files here
- GO Panel here
[edit] User contributions
- Conversion_Functions here
- EXTRACTSTR function here
- LTRIM function here
- PARSECOUNT function here
- PARSESTR function here
- REMAINSTR function here
- REPLACE function here
- RTRIM function here
- TALLY function here
- TRIM function here
- CGI demonstration here
[edit] Test programs
- Testing FOR/NEXT/STEP here
- Testing IF/THEN/ELSE here
- Testing SUB/ENDSUB/CALL here
- Testing PUSH/PULL here
- Testing WHILE/WEND here
- Testing REPEAT/UNTIL here
- Testing LEFT, RIGHT, CONCAT here
- Testing file I/O here
- Testing string comparison here
- Testing POKE and PEEK here
- Testing READ/DATA here
- Testing FUNCTION here
- Testing OPEN DIRECTORY here
- Testing ERROR CATCHING here
- Testing NETWORKING here
- Testing SERVER here
[edit] FAQ
- How to install BaCon?
Answer: Download the BAsic CONverter, there is only one file. Then set it's executable rights correctly: 'chmod +x bacon'. Run './bacon -?' to see usage.
- Status of this project?
Answer: Work in progress but already very usable.
- Will there be a Win32 Version?
Answer: No. For Windows, a good Basic to C converter can be found here.
- How to provide feedback on this project?
Answer: There is a Message Board thanks to All Basic.

