Biscuit Programming Language (BL)»Forums
Martin Dorazil
10 posts / 2 projects
Edited by Martin Dorazil on Reason: Initial post
Hi, new release 0.5.1 is out for testing here.

Release notes:
- Complete rework of compile-time value representation.
- Command line arguments are now presented in command_line_arguments global.
- Custom executable startup (removed dependency on crt on macos and linux).
- Structure inheritance.
- Switch statement.
- No need to write semicolons after functions and typedefs in global scope.
- Structure members are now separated by semicolon.
- Enum variants are now separated by semicolon.
- Bugfixes: #65, #62, #63, #57, #64, #39, #61, #68, #67

Martin Dorazil
10 posts / 2 projects
Edited by Martin Dorazil on
Hi, there is new BL version 0.6.0 out for testing. HERE

Release notes:
- Add implicit cast from array to slice. (Fixed compile time vs constant IR code emit).
- Fix invalid conversion of the sizeof result to Any.
- Fix local functions in nested scope.
- Fix nested function implicitly capturing members of upper scope.
- Fix segfault on global initializer nesting.
- Fix LLVM cast assertions on string array to slice conversion.
- Fix invalid sizeof operator result on array elem values and struct memers.
- Fix lambda functions inside nested scope.
- Add implicit conversion from pointers to bool.
- Add union data type.
- Add support of Windows terminal color output.
- Add testing formaters for printing float values.
- Add support of MSVC CodeView and PDB debug database generation via LLVM API.
Martin Dorazil
10 posts / 2 projects
Hi, new release 0.9.0 is out! here

Release notes:
- Use LLD as default linker on Windows and Linux (experimental on macOS).
- Update command line arguments to match unix common naming standarts.
- Improve build system api and remove some obsolete functions.
- Change build pipeline to call compile/compile_all explicitly.
- Fix switch related parser bugs.
- Fix unit mixing when using multithreaded build pipeline.
- Add support of shared library output.
- Add cmake build target Utils.
- Add hash into CodeLocation.
- Add namespace support.
- Add unnamed symbols. (underscore used as name is not inserted into scope)
- Add support of inline function group members.
- Use faster custom system library and SDK lookup on Windows.
- Compiler now reports unused private or local symbols.
- Cleanup modules.
183 posts / 1 project
Edited by Dawoodoz on
When your language has enums but no OOP, adding table-driven features would allow:
* Removing repeated (if x equals this or that value) if statements (look up a flag from an enum's table instead)
* Reduce the need for switch cases (get a function pointer from the table and reuse it multiple times)
* Improve performance (because it's better to read one commonly accessed word from D-cache than reading lots of long machine instructions scattered over megabytes in I-cache and jumping around randomly)
* Reduce how many mistakes are made when code changes (because each new enum value must fill all table properties)
* Multi-table lookups with clean syntax according to the third normal form. ("weapon.type.ammoType.calibre" becomes "ammoTable[weaponTable[weapon.type].ammoType].calibre")

The error-prone hard-coded way (imagine having this repeated on hundreds of locations before adding a new vehicle type in the enum).
Even if you put this in a function for each property, it takes up a lot of space and is rarely actually used.
if (vehicleType == car || vehicleType == mc || vehicleType == boat || ...) {
	// For those who have wheels or a steering wheel (The programmer should at least know why certain vehicles are selected)

The table driven way.
// Each table creates either a packed structure array for each value or one planar array per property depending on access pattern
enum VehicleType {
	key			int numberOfWheels	bool hasSteeringWheel ...
	car			4					true
	mc			2					false
	boat		0					true
	Using an attribute lookup on an integer translates to an array lookup
	so that "vehicleType.numberOfWheels" becomes
	"VehicleType_table[vehicleType].numberOfWheels" or "VehicleType_numberOfWheels[vehicleType]"
if (vehicleType.numberOfWheels > 0 || vehicleType.hasSteeringWheel) {
	// For those who have wheels or a steering wheel

You can then just add another row in your table when something new has to be handled.

Feel free to borrow any other features from my language.