Releases: kign/c4wa
Releases · kign/c4wa
Direct binary format, memory alignment hints
New features
c4wanow by default writes binary WASM files, bypassing text format. You can still save WAT file either with option-k(--keep) or with explicit output file name-o file.wat- There is
-a(--alignment) option to customize alignment hints - There is a built-in WASM interpteter (invoked with
-e/--execute) - Added command line option
-vto print preprocessor command - Optimized order of local variables (grouped by type)
- Added bulk memory compiler option
wasm.bulk-memory, emulation available min,maxare now a system library- Ignore unused global variables
- Added Python runtime wrapper
run-wasm.py - Added command line option
-xhfor extended help
Bug fixes
- Made it possible to have exported functions declared as
extern
Local scope for variables
Core language:
- Local scope for variables;
- It is now possible to declare functions with parameter names
extern int foo(int a, int b); - C-compliant variable argument functions
void printf(char * fmt, ...); - Allowed duplicate
structdefinitions (makes it easier to compile multiple files)
Preprocessor and libraries:
stringlibrary- Removed
-Poption, preprocessor is now engaged automatically - Include files shipped as part of the distribution
- Configurable preprocessor command line
- Better error reporting
Other:
- Stack begins from 1 (to avoid making zero pointers)
- Warnings about unused variables
- Recovery from errors
- Formatting of errors and warnings is more uniform and similar to GCC
Libraries, memory manager, bug fixes, and a lot more
New features in this release:
- There is now support for built-in libraries with command line option
-l; - It is now possible to compile multiple source files into one "bundle";
- Completely reworked memory management. Instead of special language construct
allocyou can have a choice: access linear memory directly with built-in globals__builtin_memoryand__builtin_offset, or use familiarmallocandfreewith one of the provided memory management libraries; - There is no longer a pre-set size for
DATAsection. It will be automatically allocated to accommodate all string literals; - Added
__builtin_popcount,__builtin_popcountl; - Escapes in string literals are now treated consistently with
chars; - Preprocessor line directives recognized, thus syntax errors reference correct file name and line number.
Bug fixes:
- Fixed relative priority of comparison and equality operators (
a < b == c < d); __builtin_clzl,__builtin_ctzlreturnint, notlong;- Fixed assigning constant to a pointer (
ptr = 0allowed,ptr = 1isn't); - Fixed boolean types,
if (longValue) ...will work now; - Fixed relative priority of comparison and equality operators (
a < b == c < d); - Fixed a problem when pointer to a
structis declared beforestructis defined; - Fixed
structarrays, e.g.arr[index].member; - Many instances where using
voidwould trigger an uncaught exception now correctly reported as syntax errors.
Stack support
Release 0.2 is nearly a full rewrite with a goal to support stack allocation. Now, you can:
- Freely use local variable of type array or
struct; - Take address
&of any local variable; - Use arbitrary-parameter functions like
printfin recursive calls.
Additionally, we now support all C operators, arrays inside struct, recursive structs, many new builtin functions, do not force unnecessary returns, and a lot more.
First implementation of the original spec
v0.1 Version 0.1