FAQ
This document answers frequently asked questions about the Alia language.
1. General Questions
1.1 What is the Alia language?
Alia is a "primordial programming language" with a truly definable syntax. Its design principle is to make syntax the core of the programming language, allowing language features to be extended and customized through syntax definitions.
1.2 What are the design goals of the Alia language?
- Syntax first: Syntax is the core of Alia; new syntax structures can be defined via the
aliaskeyword - Extensibility: Language functionality can be extended through static definitions
- Multi-backend support: Compilation backends include JavaScript, Node.js, and Rust; an LLVM backend is in planning
- Human friendly: Follows natural language habits, with a comfortable code style and rigorous logic
- AI native: Fully supports AI development, serving as a new programming system for the AI era
1.3 How does the Alia language differ from other languages?
Alia's core distinguishing feature is its definable syntax: new syntax structures can be flexibly defined via the alias keyword, whereas the syntax of other languages is usually fixed. In addition, Alia supports multi-backend compilation, allowing code to be compiled to multiple target languages.
2. Compilation Questions
2.1 Which target languages does Alia support compiling to?
The current compilation backends include the following target languages:
- JavaScript
- Node.js
- Rust
The Python, C++, and LLVM IR backends are not yet implemented. The compilation system allows customizing other target languages.
2.2 How do I set the compilation target language?
The compilation target language is determined by the --lang:<value> command-line argument or the compiler.lang field in config.json; the command-line argument takes precedence over the configuration file. When neither is declared, it falls back to the default language js.
alia build --lang:js
alia build --lang:rs
alia run --lang:js
3. Runtime Questions
3.1 How do I run Alia code?
alia start executes main.alia in the project root directory in interpreted mode:
alia start
3.2 How do I compile Alia code to other languages?
alia build compiles the project into the build/<lang>/ directory; the target language parsing rules are the same as for alia run:
alia build --lang:js
alia build --lang:rs
3.3 What is Alia's execution mechanism?
Alia uses a stack to execute code. The stack can:
run: execute the stack contentsbreak: break out of the stack
4. Standard Library Questions
4.1 What standard libraries does Alia provide?
Alia provides the following standard libraries:
args: command-line interactionffi: foreign function interfacefs: file system managementio: input and outputprocess: process managementweb: network access
4.2 How do I import standard libraries?
Standard libraries are imported via the import statement, and the as keyword assigns an alias to the module:
import 'fs' as fs
import 'process' as process
4.3 How do I use standard library functions?
Standard library functions use syntax-style invocation; multiple arguments are separated by auxiliary keywords, and zero-argument members are invoked with call:
import 'fs' as fs
import 'process' as process
fs.write 'Hello' to 'a.txt'
const home = process.envGet 'HOME'
const now = call Date.now
6. Tools and Ecosystem
6.1 Is there an editor plugin for the Alia language?
A VS Code plugin provides Alia language support, covering syntax highlighting, formatting, diagnostics, running and compiling, intelligent completion, and cross-file indexing.
6.2 How can I contribute to the Alia project?
You can contribute to the Alia project by submitting issues or pull requests via rGit.
After the project reaches v1, the development platform will move to GitHub.
6.3 What are the future development plans for the Alia language?
- Achieve self-hosting, writing the Alia compiler in Alia itself
- Improve the standard library
- Develop more editor plugins
- Support more compilation target languages
- Build a package manager
7. Version Goals
v0.1 Goals
- Interpreter implementing all syntax
- Compiler targeting JS
- Development documentation
- Project management command line
v0.2 Goals
- All standard libraries implemented
- Compiler targeting Rust
- Module space command line and website
v0.3 Goals
- Self-hosting
- Compiler targeting LLVM