Skip to content

Releases: kign/c4wa

Direct binary format, memory alignment hints

29 Jan 00:39
Compare
Choose a tag to compare

New features

  • c4wa now 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 -v to print preprocessor command
  • Optimized order of local variables (grouped by type)
  • Added bulk memory compiler option wasm.bulk-memory, emulation available
  • min, max are now a system library
  • Ignore unused global variables
  • Added Python runtime wrapper run-wasm.py
  • Added command line option -xh for extended help

Bug fixes

  • Made it possible to have exported functions declared as extern

Local scope for variables

25 Dec 05:32
Compare
Choose a tag to compare

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 struct definitions (makes it easier to compile multiple files)

Preprocessor and libraries:

  • string library
  • Removed -P option, 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

14 Dec 03:56
Compare
Choose a tag to compare

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 alloc you can have a choice: access linear memory directly with built-in globals __builtin_memory and __builtin_offset, or use familiar malloc and free with one of the provided memory management libraries;
  • There is no longer a pre-set size for DATA section. 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_ctzl return int, not long;
  • Fixed assigning constant to a pointer (ptr = 0 allowed, ptr = 1 isn'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 struct is declared before struct is defined;
  • Fixed struct arrays, e.g. arr[index].member;
  • Many instances where using void would trigger an uncaught exception now correctly reported as syntax errors.

Stack support

30 Nov 00:33
Compare
Choose a tag to compare

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 printf in 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

16 Nov 16:03
Compare
Choose a tag to compare