Cwl is a front end web language implemented with Rust procedural macros.
To install, you will need:
Then:
For windows users, run in the root directory:
Understanding the Code
Execution Steps
The code is divided at a high level into 4 parts:
-
Parse
-
Macro
-
Page Initialization
-
Execution
-
First, the cwl syntax is parsed into data structures that Rust can work with. Both the data structures and the rules for parsing are in
src/tokens.rs
. -
Next, the data structures are turned into Rust code by the
proc_macro
defined insrc/lib.rs
. This logic is the code OUTside ofquote! {}
blocks, and the code INside of those blocks eventually runs in a browser. -
Some of the code in the quote! {} blocks belongs to the 3rd group, and sets up the components and data bindings on a page when it is launched.
-
Though not entirely distinct from the initialization step, the rest of the code can be thought of as running as the page is in use, especially code triggered by event listeners.
Integration Tests
./tests
has a collection of cwl examples that render different features. Currently, they just check to see that the examples compile.