From IFWiki

Link Download
Developer Johan Berntsson
Interaction style
System details Bas2Inf is written in Ruby 1.8.2, and you need to install Ruby on your computer to be able to run the compiler
Latest version
Status Unmaintained
Uses interpreter

Browse the software database
Edit this infobox


bas2inf is a utility that converts BASIC source code into Inform 6 source code. It was written in Ruby by Johan Berntsson. The original task for which it was developed was to aid in porting the Swedish game Stuga from DEC BASIC to Inform. Support for C64 BASIC (Microsoft BASIC V2) was then added, and tested with the Sunburst Contamination game. Download from the IF Archive.


  • bas2inf can't translate BASIC code which produces graphics or sound, calls machine-language routines, or sets or reads bytes in RAM or ROM, in any meaningful way.
  • It doesn't try to emulate floating point numbers in Inform. Most BASIC adventure games only use non-integer numbers for the purpose of randomization, in lines like: "IF RND < 0.3 THEN A=1". For this reason, bas2inf recognizes the most common expressions with randomization involved and translates them to the Inform equivalent. I.e. the line above gets translated to something like "if(random(100)<30) i_A=1;" and "D=INT(RND*10)+1" gets translated to "i_D=random(10);". It also puts in warnings in the translated source code whenever it makes a translation which may not be complete and correct in every context, so a human can easily find the potential problems.
  • If the BASIC program tries to print backspace characters (which are needed for a custom keyboard input routine), bas2inf can't make them work in Inform in general. However, bas2inf allows the user to supply a command-line switch to generate Inform source code for Z-code V6, in which case the printing of backspace characters can be emulated.
  • String variables in BASIC can get new, longer values at any time during program execution, but the maximum size has to be known at compile-time in Inform. bas2inf can't figure out how much space will be needed for different string variables, so it uses a preset maximum size for all of them. The porter should study the BASIC source code carefully to determine the maximum number of bytes needed for each string variable.
This article is a stub. You can help IFWiki by expanding it.
TODO: More details please.
Browse Stable utilitiesSearch formDrilldown
Other software Authoring systemsInterpreters