I'm Spanish, and I kept watching people around me try to learn programming
and give up. Not because loops are hard, but because they were learning two
things at once: the concept, and what while even means.
So I built Fal. All words, in Spanish, no symbols at all.
si edad es mayor que 18
escribe "Puedes pasar"
si no
escribe "Todavía no"
fin
Enter fullscreen mode Exit fullscreen mode
It runs in the browser if you want to poke at it:
https://nissanboss.github.io/Fal/
Two things I didn't see coming.
The word "and" nearly broke it
In Fal, y (and) is both the logical AND and the argument separator:
si a y b # AND
suma con 1 y 2 # separator
Enter fullscreen mode Exit fullscreen mode
So y was reserved and you couldn't name a variable y. Annoying the
moment you want coordinates. I assumed it was unfixable and moved on.
Then the author of EsJS turned up in a thread and said context should
decide it, not a reserved word list. He was right, and the fix was
embarrassing: as a keyword y is always infix, it always comes after
something. As a name it's always where a value goes. The parser already
knew which one it was looking at.
escribe x y y # "x AND the variable y"
tipo Punto con x y y # fields x and y
Enter fullscreen mode Exit fullscreen mode
Exact decimals were a footnote that became the main feature
A number is an int64 while it fits, an exact rational once decimals show
up, and only falls back to float when there's no exact answer.
escribe 0.1 mas 0.2 # 0.3
escribe (0.1 mas 0.2) es 0.3 # verdadero
Enter fullscreen mode Exit fullscreen mode
Looks like a party trick. Then I wrote an example that sums 23 expenses
from a CSV: Fal gives 1546.19 and the categories reconcile to the cent.
The same sums in float give 1546.1900000000005, which doesn't reconcile
with its own parts.
Decimal and BigDecimal exist everywhere, I know. The difference is that a
kid adding two prices doesn't have to know they exist.
What it isn't
Nobody's shipping production software in this. Tree-walking interpreter,
about 8x slower than Python, no package ecosystem. It's a ramp. If someone
gets what a loop is here and then moves to Python, that was the point.
Go, ~5800 lines, no dependencies. Source:
https://github.com/NissanBoss/Fal
If you think the y fix has a hole in it, I'd like to hear it.
0 Comments
Log in to join the conversation.No comments yet. Be the first to share your thoughts.