The Eas.js file is (after the short
L
Eas 4B Licence)
pure JavaScript code without any comments and
any whitespace or semicolons that are not required.
This makes it (version Eas 4B-18073009)
as compact as
79.6 KB,
while the actual source code
(with comments, indentations and line breaks)
is almost twice as long:
147.5 KB
(which equals a book with about
120 very concisely written pages).
You can
look under the hood of Eas 4B
by placing the line
at the begiinning of your code
(or after the --export-as line).
If it is a valid code that compiles ok,
you will see
line by line how Eas code
gets translated into Javascript code
for the web browser.
Depending on your code,
you might notice the following:
1. The Javascript code has the
prefix or infix "Eas_" in each and every
function call or declaration.
This is to
avoid collissions with
other Javascript code that
you may have in your project.
2. The Javascript is much longer than the Eas code,
due to
- many
safety-ensuring subcalls
when reading or writing variables
and calling functions
- explicit
typecasting where needed
(see
T
Operational Typecasting for details)
- executing
operators that either
do not exist in Javascript or
work in a slightly different way
- parenthesizing each operator-operands group
to ensure Eas operator
precedence
(see
O
Evaluation Order for details)
- last but not least: Javascript syntax is
far less
efficient than Eas
3. The compiler performs code
optimization
by introducing temporary c[] variables
(the c stands for "compression")
wherever this makes the code shorter.
(Even for Eas elseif condition chains,
which was no triviality to implement.)
4. Loops use further compiler generated
local arrays to implement
the
pseudo-variables @ and @@
and the
crash-prevention lifeline limit
for while- and until-loops
(see
P
Loops for details).
5. Vectors show the
internal structure
of (keyed) Eas arrays.
Other than Eas or for instance PHP,
Javascript knows no keyed arrays,
only unkeyed arrays versus objects,
a constant hassle for programmers.
Thus, Eas 4B manages arrays
in Javascript as [[keys],[values]]
consistently throughout the code.
6. (This is only relevant for, and noticed by,
advanced Javascript programmers.)
Only when compiling Direct Eas 4B
(not using the --export-as directive)
user-functions and event handlers
get registered as
window[] properties.
This is necessary, as Direct Eas 4B
is run via the amongst programmers
much-dreaded eval() Javascript function,
while Export Eas 4B gets normally included
as regular Javascript via HTML <script>.