Code generator for additional keywords

Applications written for Just BASIC in languages other than Just BASIC
uncleBen
Posts: 63
Joined: Sat Oct 29, 2005 9:03 pm

Code generator for additional keywords

Post by uncleBen »

With the help of this tool, the programmer can use some new keywords in JB programs and the program JBExtensions.exe can convert it into valid JB source code.

This package may be useful for mostly advanced programmers in JB (most of it requires an understanding of how to use functions and subs).

There extensions are:
- ARRAY_NAME for passing array names to functions and subs
- variable? for using variables with unknown type (string or number) in functions and subs
- REPLACE_TYPE for creating additional function variables with unknown type
- FUNC_NAME for passing function names to other routines
- CREATE_ARRAY for creating an array that - with the help of some provided routines - keeps track of its size and can resize itself automatically if needed, as well as lets the initial items be listed with convenient syntax.
- DYNAMIC_ARRAY for passing arrays created with the previous macro to routines more conveniently
IMPORT for importing source saved in other files (the whole idea is to allow writing more reusable code).

The package includes:
- JBExtensions.exe - a commandline C++ program that does the code conversions
- ext_launcher_1_1.bas - a user interface to help operating the previous program
- tutorial.html and library_reference.html - an overview, tutorial and reference of available features
- some example codes that are used in the tutorial
- library folder with some "template" routines that can be used for writing code with the other extensions

--------------
Updated version (1.1)
- bug fixes
- ability to pass additional arguments for FUNC_NAME parameters
- HTML tutorial and library reference
- improved error reporting
- new libraries (predicates, countingsort), minor changes to unify the interface of previous libraries

--------------
Updated version (1.2)
- adapt functions to work with a row or column in a two-dimensional array (new DIM_1 and DIM_2 keywords).
- ability to define small functions at the place of call (sort-of lambda functions) with new FUNCTION_ and RETURN_VALUE keywords)
- ASSERT_TYPE_MATCH to catch errors with non-matching variables
- passing function names as extra arguments to FUNC_NAME :)
- new libraries (qsort2d, heap routines), additions to existing libraries (InRange, Iif, InList etc).
- optionally the ugly infixes in generated identifiers can be trimmed out.

----------------
Bug-fix version (1.2.1)
- the type of expressions like a$ = b$ or a$ > "A" etc was incorrectly determined to be string, whereas it is numeric (boolean).
- added ReplaceRange routine and updated library reference.

----------------
Updated version (1.3)
- new "assign-back" operators: +=, -=, *=, /=, ^=, mod=, and=, or=, xor=.
- string indexing operator []: e.g
print "Hello world"[7] '"w"

-----------------
Updated version (1.4)
- variadic functions with the new keywords: VAR_ARGUMENTS, FOR_EACH_ARGUMENT, END_FOR_EACH_ARGUMENT, ARG_COUNT and ARG_NO.
- new libraries: String algorithms, dictionaries and type conversions.
- fixed bug where functions were OK for generating sub calls.

----------------
Version (1.4.1)
- changed the behaviour of importing routines: only subs and functions will be imported and any code that needs to be inserted at the beginning of the importing file now needs to be "brought in" with the GLOBAL_CODE macro. (Breaks backwards compatibility if libraries rely on older behaviour of IMPORT - the provided libraries are updated.)

-----------------
Version (1.4.2)
- fixed a bug in the InsertionSort routine that didn't allow sorting 0-based arrays.

-----------------
Version (1.5)
- added TYPE_, TYPE_$ and TYPE_? keywords which replace the functionality of the type conversion library.
- modified error message formating (to display source file and line number)

-----------------
Version (2.0)
- TYPE_? in assignments determines the target type automatically
- _EXTENDED keyword to mark regular function as containing extensions
- FOR_EACH_ARGUMENT block for a part of a line
- handles line continuation
You do not have the required permissions to view the files attached to this post.
Last edited by uncleBen on Thu Jun 18, 2009 8:45 pm, edited 19 times in total.
uncleBen
Posts: 63
Joined: Sat Oct 29, 2005 9:03 pm

Source

Post by uncleBen »

As the archive rules require, here is the C++ source code for JBExtensions.exe
You do not have the required permissions to view the files attached to this post.
Last edited by uncleBen on Thu Jun 18, 2009 8:47 pm, edited 5 times in total.