mirror of
https://github.com/Reuh/anselme.git
synced 2025-10-27 16:49:31 +00:00
101 lines
4.3 KiB
Text
101 lines
4.3 KiB
Text
# Symbol selection
|
|
|
|
Anselme favor symbols over keywords, as it make translation easier.
|
|
|
|
We prefer to use symbols available on a standard US keyboard as it often is the lowest common denominator.
|
|
|
|
As we want to be able to write identifiers with little restriction, we try to only use symbols which are unlikely to appear naturally in a name.
|
|
|
|
Considering Anselme is aimed to people with a light programming introduction, are safe to use for syntax purposes:
|
|
|
|
* Diacritics (should be safe when used on their own): ~`^
|
|
* Usual mathematical symbols (should be safe to use): +-=<>/
|
|
* Unusual punctuation / main use is already programming (should be safe to use): []*{}|\_
|
|
* Usual punctuation used to separate parts of a sentence (should be safe to use): !?.,;:()
|
|
* Signs (could be used in a name, but also common programming symbols): @&$#%
|
|
* Usual punctuation (could be used in a name): '"
|
|
|
|
In the end, we decided to reserve all of those except '.
|
|
|
|
Using other unicode symbols may be also alright, but there also should be a way to only use these symbols.
|
|
|
|
TODO: add alias to §
|
|
|
|
Reserved symbols that are still not used in expressions: `\_?@$
|
|
|
|
Reserved symbols that are still not used as a line type: `^+-=</[]*{}|\_!?.,;)"&%
|
|
|
|
# Code Q&A
|
|
|
|
* What does "fqm" means?
|
|
It means "fully qualified matriname", which is the same as a fully qualified name, but considers the hierarchy to be mostly mother-daugher based.
|
|
It has nothing to do with the fact I'm inept at writing acronyms and realized I wrote it wrong after using it for a whole year.
|
|
* Why are built-in anselme scripts stored in Lua files?
|
|
I believe it was to avoid reimplementing the require() file search algorithm myself.
|
|
* What's a "variant"?
|
|
One of the different forms of a same function with a given fqm. No idea why I chose "variant".
|
|
* Why emojis?
|
|
They're kinda language independent I guess. I have no idea.
|
|
* Why?
|
|
I still have no idea.
|
|
|
|
# Other
|
|
|
|
Broad goals and ideas that may never be implemented. Mostly used as personal post-it notes.
|
|
|
|
TODO: some sensible way to capture text event in string litterals (string interpolation)?
|
|
|
|
TODO: the function decorator feels a bit glued-on to the current syntax
|
|
|
|
TODO: simplify language, it is much too complicated. Less line types? (var def, func, checkpoint, tag). Rewrite some ad hoc syntax using the expression system?
|
|
|
|
TODO: functions/checkpoint: separate from scoping and/or actual functions?
|
|
|
|
TODO: fn/checkpoint/tag: maybe consider them a regular func call that takes children as arg; can keep compatibility using $/§ as shortcut for the actual call.
|
|
would allow more flexibility esp. for tags...
|
|
a func def would be:
|
|
|
|
:a
|
|
stuff
|
|
|
|
but then args?
|
|
|
|
:a = $(args)
|
|
stuff
|
|
|
|
how are children passed on? overloading?
|
|
|
|
if not possible, at least make checkpoint or fn defined using the other or some superset... -> checkpoints defined using fn
|
|
|
|
OK for tag though: pushtag/poptag fn:
|
|
|
|
# color:red
|
|
a
|
|
|
|
translate to
|
|
|
|
~ tag.push(color:red)
|
|
a
|
|
~ tag.pop()
|
|
|
|
TODO: perform seen/reached/etc default variable not in interpreter but using parse-time macro
|
|
|
|
TODO: no function call without () (reference to fn instead?). Fn could be stored in save but replaced with new versions on code reload... -> how to track these references?
|
|
if we make fn first class this means anonymous fn, is it ok?
|
|
|
|
TODO: make language simple enough to be able to reimplement it in, say, nim. Especially the interpreter (we could precompile a lot of stuff...)
|
|
|
|
TODO: test reacheability of script paths
|
|
|
|
TODO: redisign the checkpoint system to work better when used with parallel scripts (if both change the same variable, will be overwritten)
|
|
|
|
TODO: redisign a static type checking system
|
|
If we want to go full gradual typing, it would help to:
|
|
* add type anotation+type check to variables (:a::number=5) and functions return ($ f()::number)
|
|
* enforce some restrictions on type (assume they're constant?)
|
|
* make some tuple/list distinction (homogenous/heterogenous types) as right now index operations are a type roulette. Or type annotate lists using some parametric type.
|
|
Advantages:
|
|
* can be used for better static variant selection; if everything is type annotated, selection could be restricted to a single function
|
|
Disadvantages:
|
|
* idk if it's worth the trouble
|
|
* could do something like `$ ()(l::list(?), i::number)::?`, but then can't return nil on not found...
|