# lotabout/write-a-c-interpreter

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/lotabout-write-a-c-interpreter).**

4,343 stars · 762 forks · C · gpl-2.0

## Links

- GitHub: https://github.com/lotabout/write-a-C-interpreter
- awesome-repositories: https://awesome-repositories.com/repository/lotabout-write-a-c-interpreter.md

## Description

This project is a C language interpreter and a practical implementation of a programming language. It parses and executes C source code directly, removing the requirement for a separate compilation step.

The interpreter is designed for self-hosting, meaning it is capable of interpreting its own source code to demonstrate recursive language processing and execution.

The system covers the primary stages of language processing, including lexical analysis, recursive descent parsing, and tree-walk interpretation using an abstract syntax tree. It manages memory and scope through a dynamic symbol table.

## Tags

### Programming Languages & Runtimes

- [C Interpreters](https://awesome-repositories.com/f/programming-languages-runtimes/c-interpreters.md) — Builds a working interpreter for the C programming language that parses and executes source code directly without compilation.
- [Self-Hosting Interpreters](https://awesome-repositories.com/f/programming-languages-runtimes/language-interpreters/self-hosting-interpreters.md) — Designed so the interpreter can parse and execute its own source code, enabling recursive language processing.
- [Lexical Tokenizers](https://awesome-repositories.com/f/programming-languages-runtimes/lexical-tokenizers.md) — Converts raw source text into a stream of tokens using a hand-written lexer before parsing begins.
- [Source Code Lexical Analyzers](https://awesome-repositories.com/f/programming-languages-runtimes/string-parsing/lexical-string-parsing-analyzers/source-code-lexical-analyzers.md) — Breaks down source code into tokens and builds an abstract syntax tree using recursive descent parsing techniques.

### Data & Databases

- [Recursive Descent Parsers](https://awesome-repositories.com/f/data-databases/data-transformation-functions/recursive-processors/recursive-logic-implementations/recursive-descent-parsers.md) — Parses source code by walking through grammar rules using mutually recursive functions.
- [Interpreter Symbol Tables](https://awesome-repositories.com/f/data-databases/read-replicas/lock-free-map-structures/symbol-table-managers/interpreter-symbol-tables.md) — Manages variable scopes and memory allocation using a runtime symbol table that supports nested scopes and lookup.

### Operating Systems & Systems Programming

- [Interpreter Memory Managers](https://awesome-repositories.com/f/operating-systems-systems-programming/virtual-memory-management/runtime-memory-limits/runtime-global-memory-managers/interpreter-memory-managers.md) — Handles variable storage and scope lifecycle dynamically during program execution without a separate compilation step.

### Software Engineering & Architecture

- [Tree-Walking Interpreters](https://awesome-repositories.com/f/software-engineering-architecture/abstract-syntax-tree-specifications/tree-walking-interpreters.md) — Evaluates programs by walking an abstract syntax tree at runtime, managing memory and scope through a dynamic symbol table.
- [Syntax Tree Construction](https://awesome-repositories.com/f/software-engineering-architecture/trees/syntax-tree-construction.md) — Builds a tree representation of program structure during parsing for subsequent evaluation.

### Part of an Awesome List

- [Programming Languages](https://awesome-repositories.com/f/awesome-lists/devtools/programming-languages.md) — Tutorial for building a C interpreter from scratch.
