A cross-platform (Windows/Linux) lexical and syntactic analyzer written in
Warning
This project is for academic learning purposes only.
It's not intended to replace the official Go compiler or cover all of its features.
- Lexical Analysis: Tokenizes Go-like code with comprehensive error reporting.
- Syntactic Analysis: Parses tokens into an Abstract Syntax Tree (AST).
- GUI Interface: User-friendly interface built with CustomTkinter.
- Error Handling: Detailed error messages with context and line/column information.
- Cross-Platform: Works on both Windows and Linux systems.
Just write and run it!
// Example 1
package main
func main() {
var n int = 3;
// Example of for loop and if-else
for (i := 0; i < n; i = i + 1) {
if i == 1 {
print("One");
} else {
print("Other:", i);
}
}
}
/* Example 2
Code between comments should be ignored
*/
package main
func main() {
flag := true;
peoples := {
"age": 30,
"name": "Ana"
};
if peoples["age"] >= 18 {
print("[+] Of legal age");
}
}
// Example 3
package main
func main() {
if age < 18 && flag {
print("You are underage and have permission");
} else if age < 18 && !flag {
print("You are underage and do not have permission");
} else {
print("You are of legal age");
}
}To run this code, you need to install some dependencies in your Python environment. To do this, you can use pip or pacman(on Arch Linux).
- Python 3.7+
- Dependencies:
customtkintertkply
For Linux, you should use the Installer.sh script to install everything automatically:
curl -sL https://raw.githubusercontent.com/ch4rum/Base_Lexer/master/Installer.sh | bashFor manual installation:
pip install -r requirements.txtSimply clone the repository and run the main script:
cd Base_Lexer
python main.pyFeel free to fork this repository and propose improvements or additional features through pull requests.
