You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
By convention, the first character of any identifier in a Loyc tree determines whether or not it is "special": ASCII codes under 40 are special, all others are "normal" identifiers. In particular, # identifies constructs (classes, namespaces, functions, for-loops, etc.), ' identifies operators ('+, '>>, '&&, etc.), and % identifies trivia (comments, newlines, etc.)
Ahh, but what if there is a language that uses allows one of these characters under 40 in a "normal" identifier? Then it would seem that the Loyc tree for that identifier should be encoded with a "normalcy" prefix to indicate it is not special, and the prefix should have an ASCII code >= 40.
I'm going to propose the + prefix for this purpose, so that if #foo is intended to be a "normal" identifier, it should be encoded as +#foo. Why plus? Mainly because, in most contexts, it is not already used for some other purpose... I considered comma , but in LES2 it is easier to escape the plus sign + (@+#foo vs @`,#foo`).
This rule is intended for encoding languages outside the Loyc project, and it is not a proposal to change existing code. It does not apply to LES, because a major purpose of LES is to express the contents of Loyc trees, including "special" ones. The lexer of LES treats # like a "normal" identifier character, but the reason for this is to be able to encode #special identifiers easily without any escaping mechanism. So if you write #foo in LES, the Symbol #foo will be stored (not +#foo). This rule does not apply to Enhanced C# either, largely for a historical reason (EC# was originally intended to play the role of encoding Loyc trees that LES plays now.)
The text was updated successfully, but these errors were encountered:
By convention, the first character of any identifier in a Loyc tree determines whether or not it is "special": ASCII codes under 40 are special, all others are "normal" identifiers. In particular,
#
identifies constructs (classes, namespaces, functions, for-loops, etc.),'
identifies operators ('+
,'>>
,'&&
, etc.), and%
identifies trivia (comments, newlines, etc.)Ahh, but what if there is a language that uses allows one of these characters under 40 in a "normal" identifier? Then it would seem that the Loyc tree for that identifier should be encoded with a "normalcy" prefix to indicate it is not special, and the prefix should have an ASCII code >= 40.
I'm going to propose the
+
prefix for this purpose, so that if#foo
is intended to be a "normal" identifier, it should be encoded as+#foo
. Why plus? Mainly because, in most contexts, it is not already used for some other purpose... I considered comma,
but in LES2 it is easier to escape the plus sign+
(@+#foo
vs@`,#foo`
).This rule is intended for encoding languages outside the Loyc project, and it is not a proposal to change existing code. It does not apply to LES, because a major purpose of LES is to express the contents of Loyc trees, including "special" ones. The lexer of LES treats
#
like a "normal" identifier character, but the reason for this is to be able to encode#special
identifiers easily without any escaping mechanism. So if you write#foo
in LES, the Symbol#foo
will be stored (not+#foo
). This rule does not apply to Enhanced C# either, largely for a historical reason (EC# was originally intended to play the role of encoding Loyc trees that LES plays now.)The text was updated successfully, but these errors were encountered: