Start
Command line
The thing you actually launch is a C# (.NET 8) host. A class library does the elegant work. A tiny executable knocks on its door.
Invocation
alana <file.alana> alana start "<path_to_your_folder>"
- No argument → she prints usage and waits, politely unused.
alana start "…"writes a basicmain.alanain that folder.- Missing file →
Alana error: file '…' not found. - Anything thrown →
Alana error: …because hiding it would be rude.
Host entry point
This is the whole ceremony. It is not mysterious. It is just C# wearing a dress.
namespace Alana
{
public static class Alana
{
public static void Main(string[] args)
{
try
{
if (args.Length == 0)
{
Console.WriteLine("Usage: alana <file.alana>");
return;
}
string file = args[0];
if (!File.Exists(file))
{
Console.WriteLine($"Alana error: file '{file}' not found.");
return;
}
string source = File.ReadAllText(file);
Lexer lexer = new Lexer(source);
Token[] tokens = lexer.TranslateToken();
Parser parser = new Parser(tokens);
List<Statement> statements = parser.Parse();
Interpreter interpreter = new Interpreter();
interpreter.Execute(statements);
}
catch (Exception ex)
{
Console.WriteLine($"Alana error: {ex.Message}");
}
}
}
}
The layers, in order: Lexer, Tokens, Parser, AST, Interpreter. No encore.