https://github.com/santerijps/programming-language-tutorial
This project is a tutorial for myself to learn how to create your own programming language.
https://github.com/santerijps/programming-language-tutorial
c lexer-parser programming-languages
Last synced: 7 months ago
JSON representation
This project is a tutorial for myself to learn how to create your own programming language.
- Host: GitHub
- URL: https://github.com/santerijps/programming-language-tutorial
- Owner: santerijps
- Created: 2022-06-20T14:13:10.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2022-06-30T10:38:47.000Z (almost 4 years ago)
- Last Synced: 2025-01-11T18:27:30.883Z (over 1 year ago)
- Topics: c, lexer-parser, programming-languages
- Language: C
- Homepage:
- Size: 27.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# `pltc`: Creating a programming language from scratch
This project is a tutorial for myself to learn how to create my own programming language. I decided to write all the code in C. Below is a list of things that I would like to try:
- a lexer
- a parser
- an interpreter
- produce native executables
The development compiler is [Tiny C Compiler aka. `tcc`](https://bellard.org/tcc/). It compiles code really fast. The name of my programming compiler is `pltc`, which simply stands for _Programming Language Tutorial Compiler_.
## Getting started
### Install `tcc` if you don't already have it
1. Go to [this URL](http://download.savannah.gnu.org/releases/tinycc/) and download the appropriate version
2. Extract the downloaded zip file where-ever you like
3. Add the path to the `tcc` executable file into your environment
4. Confirm that it works by running `tcc --help`
### Clone this repository
On the command line (if you have `git` installed):
```sh
git clone https://github.com/santerijps/programming-language-tutorial
```
### Compile the binaries
With `make`:
```sh
cd programming-language-tutorial
make
```
With `tcc`:
```sh
cd programming-language-tutorial
mkdir bin
tcc src/pltc.c -o bin/pltc
```
### Try the examples
```sh
cd programming-language-tutorial
bin/pltc examples/example.py
```