Create you own Language!

Unleash your creativity and build your own programming language with motherlang


🛠️ Custom Keywords

Define unique keywords for variable declarations, loops, conditions, and more.

🔍 Lexical Analysis

Transform your code into tokens with our powerful lexer.

✨ Parsing Magic

Convert tokens into a syntax tree effortlessly.

🔮 Interpretation Wizardry

Execute your custom language programs and see the results instantly.

How It Works

1. Define Your Language

Use the LanguageDefinition class to set your custom keywords.

2. Tokenize the Input

Create a Lexer object to convert your input into tokens.

3. Parse the Tokens

Use the Parser class to transform tokens into a syntax tree.

4. Run Your Program

Execute the statements using the Interpreter class and enjoy the results.

Example Program

import 'package:motherlang/motherlang.dart';

void main() {
  final program = '''
    ai will replace n1 = 0;
    ai will replace n2 = 1;

    ai will replace count = 0;

    weekly sprint (count < 10) {
        debug n1;
        ai will replace n3 = n1 + n2;
        ai will replace n1 = n2;
        ai will replace n2 = n3;
        ai will replace count = count + 1;

  // Prepare the language definition
  final languageDefinition = LanguageDefinition(
    variableDeclarationKeyword: 'ai will replace',
    whileLoopKeyword: 'weekly sprint',
    ifConditionKeyWord: 'maybe',
    elseIfConditionKeyword: 'whatIf',
    elseConditionKeyword: 'nevermind',
    printKeyword: 'debug',
    trueBooleanKeyword: 'feature',
    falseBooleanKeyword: 'bug',
    logicalNotKeyword: 'this is not real code',

  final lexer = Lexer(
    input: program,
    languageDefinition: languageDefinition,
  final tokens = lexer.tokenize();

  final parser = Parser(tokens);
  final statements = parser.parse();

  final interpreter = Interpreter();
  final output = interpreter.interpret(statements);


Get Started

Ready to create your own programming language? Follow our guide and start coding today!

Get motherlang on View on GitHub