This repository contains a scanner for the made-up language Hawk, developed as part of the Programming Language Fundamentals course at the University of Houston Clear Lake.
The Hawk language scanner is designed to read source code written in Hawk, identify its lexemes and tokens, and check for basic syntax errors. This project focuses on building a lexical analyzer (lexer) and a syntax analyzer (parser), which together form the core of the scanner. I've also published a VS Code extension for syntax highlighting.
- Lexical Analyzer (Lexer):
- Reads the source code.
- Identifies and categorizes lexemes (keywords, identifiers, operators, etc.).
- Generates corresponding tokens.
- Syntax Analyzer (Parser):
- Ensures that the sequence of tokens follows Hawk's grammar rules.
- Checks for syntax errors in the code.
- Clone the repository:
gh repo clone durkisneer1/Hawk-Scanner
- Setup the Meson build system:
meson setup build
- Change to the
build
directory:cd build
- Compile the generated build files:
meson compile
- Run
scanner.exe <filepath>
within a terminal to view trace output.
- C++ compiler (e.g., g++ or clang++)
- Meson and Ninja build systems installed through
pip
with Python - Basic understanding of the Hawk language syntax (read example scripts)
src/
: Contains the source files for the scanner.include/
: Header files for the project.test/
: Sample Hawk programs for testing the scanner.
This project is for educational purposes and is licensed under the MIT License.