Linguo is an experimental programming language designed to be as close to natural English as possible. It features a readable, English-like syntax while maintaining the power of a modern programming language.
remember greeting as "Hello, World!"
say greeting
- Natural English Syntax: Write code that reads like English sentences
- Strong Type System: Implicit type inference with runtime type checking
- Control Flow: Intuitive
when/or/doneconditionals anddo this N timesloops - Functions: Support for parameterized functions with return values
- JIT Compilation: Uses LLVM for optimized Just-In-Time compilation
- String Operations: Built-in string concatenation and manipulation
- Arithmetic: Natural language arithmetic operations (
increase,multiply by, etc.)
- Installation
- Quick Start
- Language Guide
- Building from Source
- Example Program
- Development
- Contributing
- LLVM 19 with development headers
- Flex 2.6+
- Bison 3.x
- C++17 compiler
sudo apt update
sudo apt install flex bison llvm-19 llvm-19-dev clang++-
Clone the repository
git clone https://github.com/yourusername/linguo.git cd linguo -
Build the compiler
mingw32-make # on Windows # or make # on Unix-like systems
-
Run an example
./linguo examples/test.linguo
// Variables
remember x as 42
remember greeting as "Hello!"
// Arithmetic
increase x by 5
multiply x by 2
divide x by 3
// Output
say x
say "Result: " + x
// Control Flow
when x is more than 10
say "x is greater than 10"
done
// Loops
do this 3 times
say "Loop iteration"
done
// Functions
create add a b
remember result as a
increase result by b
give back result
end
-
Generate lexer and parser
flex linguo.l # produces lex.yy.cpp bison -d linguo.y # produces linguo.tab.cpp and linguo.tab.hpp
-
Compile
mingw32-make # on Windows # or make # on Unix-like systems
-
Clean build files
mingw32-make clean # on Windows # or make clean # on Unix-like systems
See our comprehensive example that demonstrates all language features:
// Basic variable declaration and output
remember greeting as "Welcome to Linguo!"
say greeting
// Arithmetic operations
remember x as 42
increase x by 8
multiply x by 2
say "Result: " + x
// Functions with parameters
create calculateAverage x y z
remember sum as x
increase sum by y
increase sum by z
remember average as sum
divide average by 3
give back average
end
// Function calls
remember avg as call calculateAverage with 15, 25, 35
say "Average is: " + avg
Find more examples in examples/test.linguo.
The compiler is structured into several components:
linguo.l: Flex lexical analyzer specificationlinguo.y: Bison grammar and parser rulesast.h: Abstract Syntax Tree definitionscodegen.cpp: LLVM IR generation and optimizationmain.cpp: Compiler driver and CLI
Contributions are welcome! Here's how you can help:
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
Please ensure your code follows our style guide and includes appropriate tests.
This project is licensed under the MIT License - see the LICENSE file for details.
- LLVM Team for their excellent compiler infrastructure
- The open-source community for inspiration and support
Made with ❤️ by Muhammad Husnain Ali