Skip to content

Naming Conventions

Nikitin Ilya edited this page May 31, 2020 · 7 revisions

DRAFT - NO WORKING IMPLEMENTATION

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:

  1. Lexer converts all - to _;
  2. 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')
  1. Will be tokenized to:
Console.write_line('Hello')
  1. 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()

Support for other languages naming is in progress,
but you still can use identifiers, that are original to target language.

Introduction to language syntax

Expressions

Toolset architecture

Public compiler interface

  • Units & Modules - TODO
  • Compiler class

Backend

  • Lexer (Tokenizer)
  • Syntax tree
  • Traversing

Miscellaneous

Clone this wiki locally