9 comments

[ 2.4 ms ] story [ 122 ms ] thread
Easylang is a domain-specific language for learning programming and also for small web canvas applications. It has a reduced set of functions, a simple syntax, a browser IDE and integrated graphic commands. It is statically typed and has only strings and numbers (floating point), arrays of strings and numbers, and arrays of arrays as data types. Easylang was made by me and is open source (GPL).

It is written mainly in C and is run in the browser using WASM (WebAssembly). The Easylang programs are compiled directly in the browser into an AST (abstract syntax tree) and this is then interpreted.

A recently added feature is that certain code can be compiled directly into WASM code. This is useful for the "inner loop" and can multiply the speed of execution. This feature is experimental and currently only works for certain language constructs. You can test the speed difference in this example by changing "fastfunc iter" to "func iter".

The code of this example is embedded in the URL.

I find this amazing! The code read/writes like a high level interpreted language and runs like offline compiled code. The fact that it works in a 'random' browser on a 'random' platform is the cherry on the cake.
A friend of mine recently asked me the dreaded "How do i get into programming". I pointed them to easylang.dev!

Thank you for making easylang, I plan to use it to teach anyone new to coding.

This is awesome, but reminds me of something I was recently wondering: why are there no infinite-zoom Mandelbrot viewers? They all stop at a certain level of zoom instead of generating the finer details. What's the limitation? I can't imagine you'd have to render the entire fractal in fine detail to zoom in on a specific piece.
Usually programs hit the limits of float32 or float64. A float64 has a around a 10 to the minus 16 precision to play with (53 bit significand) so you can hit the zoom limit with little effort.

There are various techniques to go further (obviously one is just to use arbitrary precision arithmetic, another is for example perturbation theory[1])

And there are plenty of "infinite" (or at least some arbitrarily huge level) zoom viewers. You can find videos of zooms going into 10 to the power of thousands. The deeper you go the longer the calculations take.

[1] https://en.m.wikipedia.org/wiki/Plotting_algorithms_for_the_...

Couldn't you seamlessly replace one number domain with another to keep the precision up?

E.g. remap: 1e-7 to 9e-7, to numbers 1 to 9?

Floating point already does that with separate mantissa and exponent bits. Regardless, you still have a limited number of bits for precision.
I'm replying again to you as I can't edit my previous reply. I forgot to mention that the iteration count in the linked site is set by default to only 200. That's the number of iterations of the formula (for the mandelbrot it's z=z*2+c where z and c are complex) is calculated to determine whether a given value of c (coordinate on the complex plane) diverges or not (the mandelbrot is the set of all values of c where it doesn't diverge. z starts at 0).

Thus you can increase the iteration count, but again more calculations.

All other things equal, more zoom leads to more precision and more iterations.