The Go-to-PHP Compiler is a project designed to help me learn about lexer, tokenization, and code generation. The primary goal of this compiler is to translate Go code into PHP code, allowing for a better understanding of how compilers work and the intricacies of language translation.
- Lexer and Tokenization: The compiler includes a lexer that tokenizes Go source code into meaningful tokens, which are then used for parsing.
- Parsing: The project implements a parser that constructs an Abstract Syntax Tree (AST) from the tokenized input.
- Code Generation: The compiler generates PHP code from the AST, allowing for the execution of Go-like code in a PHP environment.
This project serves as a hands-on learning experience for the following concepts:
- Understanding how lexers work and how they tokenize source code.
- Learning about parsing techniques and constructing an AST.
- Exploring code generation and how to translate one programming language into another.
A special thanks to Tyler Laceby on YouTube for his excellent explanations of lexer and tokenization. His tutorials have been instrumental in guiding me through the process of building this compiler.
To get started with the Go-to-PHP Compiler, clone the repository and run the following commands:
git clone https://github.com/ZeBartosz/go-to-php-compiler.git
cd go-to-php-compiler
go run src/main.go
If you have suggestions for improvements or would like to contribute to the project, feel free to open an issue or submit a pull request.
This project is licensed under the MIT License.