-
Notifications
You must be signed in to change notification settings - Fork 2
Naming Conventions
As you may notice, Axion has support for dash-case identifiers,
like write-line
, etc.
This is the preferred naming case for almost everything in the language,
due to it's good readability and typing simpleness.
dash-case
names in Axion are treated just like snake_case
ones, so -
is a substitution for _
.
However, it has some other naming handling functions, to enforce naming consistency:
Name conversion is performed as follows:
- Lexer converts all
-
to_
; - Lexer performs conversion that's specific for each target, e. g. C#:
When output target is C#, then all dash-case names will be replaced with PascalCase ones, like:
This Axion code:
Console.write-line('Hello')
- Will be tokenized to:
Console.write_line('Hello')
- And then, name will be converted to this C# code:
Console.WriteLine("Hello!");
NOTICE: This will be done only if WriteLine
name exists in current scope.
If it is not, then only 1-st step will be executed, and name 'll be written as-is.
e.g, C# may contain following code:
Utilities.nonStandardly_named_method();
And you try to invoke it from Axion like that:
Utilities.non-standardly-named-method()
Lexer will translate name to this:
Utilities.non_standardly_named_method()
BUT then, Lexer will check that NonStandardlyNamedMethod
isn't defined in C#,
and it won't convert it.
So, you must specify it in Axion as-is:
Utilities.nonStandardly_named_method()
Expressions
Public compiler interface
-
Units & Modules
- TODO -
Compiler
class
Backend
- Lexer (Tokenizer)
- Syntax tree
- Traversing