Menu

ECMA-55 Minimal BASIC compiler / News: Recent posts

ECMA-55 Minimal BASIC Version 2.40 Released

Version 2.40 of Minimal BASIC Compiler Released

This release continues the effort to implement all of the ECMA-116 Full BASIC mathematical functions by adding DATE and TIME. It also adds our first string functions, DATE$ and TIME$, also from ECMA-116 Full BASIC. It also fixes the bug where PI and MAXNUM didn't work as functions in DATA statements when -X was specified. AVX code generation was removed since it actually generated programs that were slower since this compiler has no vectorization logic. Finally, a new appendix has been added to the included book, and the generated PDF for the book is compressed and linearized, while still remaining PDF/A-1b.... read more

Posted by Gatewood Ham 2021-08-31

ECMA-55 Minimal BASIC Version 2.31 Released

Version 2.31 of Minimal BASIC compiler released

This release is composed of a few bug fixes, some build improvements, and an upgrade of the runtime mathematical function assembly code which is now based on SLEEF-3.5.1.

Bug Fixes:

  • Fix problems in parseinput found with cppcheck.
  • Fix some memory leaks in symbol_table module self-tests.
  • Change Makefile.clang so that if PIE=1 is selected, small code model is used, because after 4 major versions it appears clang will never fix their large mode code generation to work reliably with PIE.
  • Change clang compiler detection so it works even on Ubuntu 20.10 where they intentionally sabotage the usual --version identification string.
  • Fix obviously incorrect comments in load_textdata.[ch] files.
  • Convert a few tabs that crept into the runtime assembly to spaces.
  • Fix warning in robert1.c's realint().
  • Fix warning in semantic_check.c's sc_nvar().... read more
Posted by Gatewood Ham 2021-02-24

ECMA-55 Minimal BASIC Version 2.30 Released

Version 2.30 of MinimalBASIC compiler release

This is another big release with many new features, including many more of the ECMA-116 Full BASIC mathematical functions, fixes for a couple of rare corner cases with the power operator, more accurate LOG2 and LOG10 runtime routines, and finally a switch from calling the kernel directly to properly using the vDSO for access to kernel time information. To make reading the assembly easier, source lines from the input BASIC program are now inserted as comments in the assembly language output.... read more

Posted by Gatewood Ham 2020-06-12

ECMA-55 Minimal BASIC compiler version 2.29 released

ECMA-55 Minimal BASIC compiler version 2.29 released

Version 2.29 of MinimalBASIC compiler release

This is a big release with major bugfixes and many new features. Even if you don't use the new features, you'll get to enjoy the improvements in accuracy. This is especially true for people who use the '-s' option (32 bit math). If you are actually reading the assembly code, there are more comments and a little bit less indirection. And last, but certainly not least, the included book continues to improve, and its appendix does document all the newly added math functions.... read more

Posted by Gatewood Ham 2020-05-15

ECMA-55 Minimal BASIC compiler version 2.28.1 released

ECMA-55 Minimal BASIC compiler version 2.28.1 released

Version 2.28.1 of MinimalBASIC compiler release

Bug fix:

  • Move pos variable outside of __GLIBC__ ifdef like it should be, and add
    comment. This fixes building with musl.

Version 2.28 of MinimalBASIC compiler release

Bug Fixes:

  • Fixed many typographical errors in NBS tests 12, 39, 43, 115, and 128 which
    were reported by Jorge Giner Cordero (author of bas55 interpreter).
  • Fixed some outright wrong comments for FATAL and ICE functions.... read more
Posted by Gatewood Ham 2020-04-17

ECMA-55 Minimal BASIC compiler version 2.27 released

ECMA-55 Minimal BASIC compiler version 2.27 released

Bug Fixes:

  • Fix DAG folding so it works for floats too, not just doubles. For the end user, this means that using ecma55 with the options -s -X -O3 all active simultaneously now finally works correctly.
  • Fix some corner cases for non-default INPUT_WIDTH compile-time constant values.

Improvements:

  • Replaced buggy run_tests NBS test harness with an all-new test harness written using GNU make.
  • Replaced buggy run_tests2 and run_tests3 HAM test harness with an all-new test harness written using GNU make.
  • Stop allocating large arrays on the stack, and allocate them with malloc() as it should be instead.
  • Stop using static buffers for g_fmt() conversions.
  • Stop using duplicate field names in different structures in the symbol table.
  • Add tests for add_data_literal() to symbol table self-test code.
Posted by Gatewood Ham 2020-03-07

Version 2.25 of MinimalBASIC released

Version 2.25 of MinimalBASIC compiler release

Bug Fixes:

  • Fix a bug in the "Subroutine Example Flowchart (2 of 2)" in the tutorial book.
  • Fix bug in ast module self-test where LEN() was treated like PRINT.
  • Fix bug in scanner2 module self-test where LEN() was tested without -X option being specified.
  • Fix rounding of array subscript expression values.

Improvements:

  • Only emit len_macro in generated assembly when it is needed.
  • Only call gettimeofday syscall for RND if RANDOMIZE is used, since it is not needed to generate a repeatable sequence for the case when RND is used without RANDOMIZE.
  • Use smarter assembly sequences for clearning/initializing buffers.
  • Use smarter FOR .. NEXT loop code generation that does one branch per iteration instead of two.
  • Enable stack protector when building the compiler with pcc.
  • Use proper TeX double quotes in the tutorial book.
  • Add a new section in arrays chapter of book that explains non-integral subscripts and why you do not really want to use them with examples.
  • Generalize sequential search flowchart in the tutorial book to work for N elements.
  • Clarify preface of book to specify only an AMD64 compatible CPU is needed. Originally, if the text was interpreted literally, it mandated an actual AMD brand CPU.
  • Improve loop chapter in the book by adding a summary detailing the critical ideas about loops from the chapter.
  • Improve array chapter in the book by rewriting several parts, and being more pedantic in explanations about OPTION BASE and DIM. Add a new example program that shows issues when using floating point values for subscripts and loop increments.... read more
Posted by Gatewood Ham 2018-01-05

Version 2.24 of MinimalBASIC released

Version 2.24 of MinimalBASIC compiler released

Improvements:

  • Add new chapter about singly linked lists to included tutorial book.
  • Rewrite BASICC, BASICCS, and BASICCW man pages so that they are easier to understand.
  • Use a more portable style of roff in the manual pages. They have been tested and work fine with mandoc in addition to the groff for which they were originally written.
  • Use mmap() for reading BASIC source file.
  • Improve self-tests for parser2, ast, dag, asmgen, scanner2, and symbol_table modules.
  • Add standard LEN() function for string length (available with -X option).
  • Add test P374 to test LEN().
  • Make clean targets of Makefile.* remove core files.
  • Stop using pinsrd/pextrd for moving data between low 32 bits of fp registers and 32 bit gp registers and just used movd in assembly code.
  • String comparison is extended to support { '<', '<=', '>', '>=' } (available with -X option).
  • Improve test harness.... read more
Posted by Gatewood Ham 2017-11-19

Binary Action Pack 2.23 Released!

The Binary Action Pack (BAP) with a statically linked version of the compiler has been created and added to the download area. This is for people who want to use the compiler for their ECMA-55 Minimal BASIC programs, but who do not want to build it from source. It is only for post 4.0 Linux on AMD64/INTEL64 systems.

Posted by Gatewood Ham 2017-10-30

Version 2.23 of MinimalBASIC compiler released

Version 2.23 of MinimalBASIC compiler released

Improvements:

  • Add self-test code to asmgen module.
  • Use a more straight-forward implementation of unary minus.
  • Prevent warnings on switch statement intional fall through cases when using gcc version 7 and newer.
  • Align floating point literal constants on 8 byte boundaries.
  • Use '_' instead of '-' for unary minus in debug output to distinguish it from binary minus.
  • Only call fold_numeric_expression() in emit_numeric_expression() for trees; DAGs do their own folding.
  • Make dag_binop() smarter about retuster usage for commutative operators.
  • Improve the way text assembly files are included in the compiler.
  • Refactor some large functions into pieces to simplify the code.
  • Rearchitect the text assembly language routine access to allow a single load of an array indices instead of loading address for each routine one at a time. It adds support for lookups of address in the program for PIE programs in addition to the existing support for traditional executables.
  • Small improvements to generated assembly to use 32 xor and mov when possible.
  • The Makefile.* files have been improved and they run more self-tests.
  • The -V output to ecma55 now indicates if the stack protector and/or address sanitizers were used when ecma55 was built.
  • Fix many, many typographical errors in comments.
  • Add test P373 to test INT() more thoroughly.... read more
Posted by Gatewood Ham 2017-10-25

Version 2.22 of MinimalBASIC compiler released

Version 2.22 of ECMA-55 MinimalBASIC compiler released

This is a bugfix release.

Improvements

  • Improve implementations of runtime library code for myisinf, myisnan, and mystrcmp.
  • Improve comments in memcpy, mystrlen, and mystrcpy.
  • Improve runtime library code and comments in it for initbuffer, outputbuffer, flushoutputln, appendbuffer, nextzone, and isterminal.
  • Add new test case P371 which tests DAG simplification more thoroughly.
  • Improve indexing in included tutorial book, and add a note that SGN() is often called signum in math textbooks.... read more
Posted by Gatewood Ham 2017-06-24

Version 2.21 of ECMA-55 MinimalBASIC Compiler Released

Version 2.21 of ECMA-55 MinimalBASIC Compiler Released

This release has internal improvements for both corrections and ease of maintenance. Also, the runtime string routines were improved.

Posted by Gatewood Ham 2017-04-06

Version 2.19 Released

Version 2.19 of MinimalBASIC compiler release

Most of the work for this release involved fixing the dag module. It appeared
to be working because none of the existing test cases were complex enough, but
that was just luck. Once this was fixed, the very same complex test case
showed errors never seen before in the pretty printing code regeneration
parenthesis handling when using the unary minus operator, so the ast module was
updated to handle those cases. As part of tracking these bugs down, many other
small corrections were made, especially in the dag module self-tests which were
improved and expanded. Other work included converting the generated code
sequences for unary minus to use macros like the other operations making the
expressions in the assembly file easier to follow.... read more

Posted by Gatewood Ham 2016-10-03

Version 2.17 Released

Version 2.17 Released

This release fixes an embarrassing, long-standing bug in unary +/- handling. It also includes a complete open source book on learning to program using ECMA-55 Minimal BASIC. In addition, this release includes improvements in both the quantity and quality of source code comments.

Posted by Gatewood Ham 2016-07-04

Version 2.14 of MinimalBASIC Compiler Released

Version 2.14 of MinimalBASIC Compiler Released

This version improves error reporting for function calls with invalid arguments, and has fixes for detecting invalid TAB() function calls.

Posted by Gatewood Ham 2015-09-27

Version 2.11 of MinimalBASIC compiler released

Version 2.11 of MinimalBASIC compiler release

Fix a minor bug in uninitialized scalar string variable reporting.

Posted by Gatewood Ham 2015-08-08

Ancient tarballs removed

The tarball versions in the Files section older than version 1.7 have been removed.

Posted by Gatewood Ham 2015-08-08

Version 2.10 of MinimalBASIC compiler released

Version 2.10 of MinimalBASIC compiler released

Renumber support has been added to the pretty printer.

Improvements:

  • Removed lineno module and use line numbers in the AST instead.
  • In the AST, specify jump targets as links to statements instead
    of as text, so that renumbering is possible.
  • Add -R option that will renumber by 10 if possible, falling back
    to 2 and then 1 if the number of lines is too great to fit within
    the 9999 line number maximum.
  • Add some implementations of classic computer science algorithms as
    examples.
  • Minor documentation improvements.
Posted by Gatewood Ham 2015-07-14

Version 2.00 of MinimalBASIC compiler released

Version 2.00 of MinimalBASIC compiler released

AVX code generation has been completed.

Bug Fixes:

  • Fixed several bugs in binary_multiply exception handling.
  • Fixed several bugs in binary_divide exception handling.
  • Fixed a bug in register spill/fill where offsets into the stack were
    specified incorrectly.
  • Fix bug where assembly code was storing 1 to ah instead of al in
    feature tests.
  • Fix bug where scanner would coredump if a character outside of
    7 bit ASCII was encountered.
  • Fix bugs in expression optimizer that prevented required exceptions
    from occuring.
  • Fix ICE() when a non-existent filename was given as the Minimal BASIC
    input file.... read more
Posted by Gatewood Ham 2015-05-26

Version 1.99 of MinimalBASIC Compiler Released

Version 1.99 of MinimalBASIC compiler released

The featured change in this version is the moving of the assembly generating AST walking code and the semantic checking code from the parser into separate modules.

Bug Fixes:

  • The canrelease target of Makefile now works for tcc.
  • Removed generation of unused dedicated floating point stack.

Improvements:

  • If we are using GNU libc, glibc-specific functions are used to have the compiler
    check itself for memory leaks.
  • Intercept malloc(),realloc(),strdup(),strndup() to check for heap exhaustion.
  • Implment optional (off by default) heavy-duty memory allocation tracking for
    finding memory leaks.
  • AVX versions of SIN, COS, TAN, ATN, LOG, EXP, and POW (generated from SLEEF)
    have been added and are used if the -A switch is specified when ecma55 is run.
  • Update tests to run AVX versions if the processor the tests are running on
    supports AVX.
  • Fix code generation so that if runnong on 64bit mode it will just use movq to
    move between GP and XMM registers.
  • Update code generation to only include what is needed in the generated assembly
    file.
  • Split out code that walks the AST and generates the assembly to a new asmgen module.
  • Split out code that walks the AST and does semantic checking, symbol table
    populating, and jump target verification into a new semantic_checks module.
Posted by Gatewood Ham 2015-05-05

Version 1.98 of MinimalBASIC compiler released

Version 1.98 of MinimalBASIC compiler released

The featured change in this version is that now the scanner generates tokens
only when they are needed by the parser instead of pre-scanning the entire
input file before the parse. The other changes are many small bug fixes for
corner cases that never manifested themselves in the existing test suite
programs. In addition, error reporting was improved to provide more
information when the compiler crashes with an ICE or hits a fatal error. One
user-visible improvement is that the print buffer is flushed of any pending
output before an INPUT statement, allowing prompts to work as expected.... read more

Posted by Gatewood Ham 2015-04-22

Version 1.9 of MinimalBASIC compiler released

Version 1.9 of MinimalBASIC compiler released

Compiler now generates native SSE register math!

Bug Fixes:

  • bt self-test code fixed to adjust to API change for bst_delete_all()
    which now requires a second argument.

Improvements:

  • Constant folding implemented for binary add, subtract, multiply, power,
    and divide, and for unary minus. This optimization is performed at
    optimization level 1 (-O1) or higher.
  • Floating point math processing converted from software stack to native
    SSE register math. This required massive changes through the parser and
    code generator, including implementing a local register allocator.
    It has been tested with a limit of only 3 available XMM registers and
    then NBS test suite passes. With the default value of 16, spills will
    not occur for normal arithmetic expressions due to the short line length
    of 72 characters specified by ECMA-55 Minimal BASIC. All arithmetic
    operations are done register-to-register in this initial implementation.
  • The 'make check' now runs valgrind for all successful compiles if it
    is available, tallying the number of leaks found.
Posted by Gatewood Ham 2014-12-12

Version 1.8 of MinimalBASIC compiler released

Version 1.8 of MinimalBASIC compiler released

Bug Fixes:

  • Make assign_magicvar() and add_float_literal() check input paramters more carefully.

Improvements:

  • Improved comments
  • Made compile-time forstack[] dynamically allocated
  • Converted some defined constants to const constants
  • Improve parser2 self-test output when run with '-v' option so that magic variable and floating point literal symbol table data is valid.
  • Fix misleading variable names in convert_unsigned_integer().
  • Generate and dump expression trees during the parse (visible with the -v option to ecma55).
  • Generate code for string expressions using the AST generated by the parse.
  • Generate code for numeric expressions using the AST generated by the parse.
Posted by Gatewood Ham 2014-11-27

Version 1.75 of MinimalBASIC compiler released

Version 1.75 of MinimalBASIC compiler released

Bug Fixes:

  • Fix error in calculating operand_stack_size when using 64bit floating point stack.
  • Fix three bad lines in P012.BAS reported by Jorge Giner Cordero, and fix other typos I noticed while merging his fixes.
  • Fix typo in P014.BAS reported by Jorge Giner Cordero.
  • Fix typo in P043.BAS reported by Jorge Giner Cordero.... read more
Posted by Gatewood Ham 2014-10-09

Version 1.7 of MinimalBASIC compiler released

Version 1.7 of MinimalBASIC compiler released

Initial SSE4 support is now working!

Bug Fixes:

  • Fix another TAB() corner case. Last fix added this:
    curzone=(column/ZONE_WIDTH)+1U
    but it needs to be this since columns are 1-based:
    curzone=((column-1U)/ZONE_WIDTH)+1U

Improvements:

  • Added P215, P216 and P217tests for floating point conversion based on some
    tests by Rick Regan (Exploring Binary) that caused PHP (CVE-2010-4645)
    and Java (CVE-2010-4476) trouble once upon a time.
  • Unifiy SIGNIFICANCE_WIDTH and EXRAD_WIDTH definitions for all files so
    if it is changed in globals.c, both the compile-time code and runtime
    code will use the same rules.
  • Added P218 test for the TAB() fix.
  • Add -4 switch for SSE4.1 support. Modify binary math operator macros to
    use PINSR[QD] and PEXTR[QD] when SSE4.1 support is requested.
  • Update ABS(), INPUT and READ code generation to use SSE4 for -4 switch.
  • Update UDF parameter processing to use a macro like other arithmetic
    expression code.
  • Add -A switch for AVX support. For now, nothing is actually using this.
Posted by Gatewood Ham 2014-09-21