Skip to main content

# compilerlab5

A pip-installable package containing five Compiler Design laboratory programs based on **Experiment 6-10.pdf**:

1. LALR bottom-up parser demo

2. SLR(1) parsing demo

3. Three-address code generator

4. Lexical analyzer for operators

5. Shift-reduce parser

## Installation

Install the package from PyPI:

python -m pip install compilerlab5

After installation, the package can be used from any supported Python environment.

## Usage

### 1. LALR Bottom-Up Parser

compilerlab5 lalr

Example input:

i+i\*i

### 2. SLR(1) Parser

compilerlab5 slr

Example input:

dd

### 3. Three-Address Code Generator

compilerlab5 tac

Example input:

a+b\*c

### 4. Lexical Analyzer for Operators

compilerlab5 operator

Example input:

\+

### 5. Shift-Reduce Parser

compilerlab5 shift-reduce

Example input:

id+id\*id

## Individual Commands

The individual console commands are also available:

lalr-parser

slr-parser

tac-generator

operator-validator

shift-reduce-parser

## Python Module Usage

The package can also be executed through Python:

python -m cpp lalr

python -m cpp slr

python -m cpp tac

python -m cpp operator

python -m cpp shift-reduce

Here, cpp is the internal Python package name, while compilerlab5 is the public PyPI distribution name.

## Local Testing

From the project directory:

python -m pip install --upgrade build

python -m build

Install the generated wheel:

python -m pip install dist/compilerlab5-0.1.1-py3-none-any.whl

## PyPI Publishing

Build the package:

python -m build

Check the generated distributions:

dir dist

Upload the distributions using Twine:

python -m twine upload dist/\*

For PyPI authentication, use the username:

\_\_token\_\_

and a valid PyPI API token as the password.

## Portability

The Python package does **not** require GCC or Clang to run the Python implementations.

Python is required on the target system.

The original C source files from the supplied **Experiment 6-10.pdf** are also included under:

src/cpp/c\_sources/

These source files are included for laboratory/reference purposes.

## Package Information

**Distribution name:** compilerlab5

**Python package/module:** cpp

**Current version:** 0.1.1

**License:** MIT

## Educational Purpose

This is a teaching/laboratory package containing examples for Compiler Design experiments 6-10.

The parser examples intentionally follow the structure and terminology of the supplied laboratory material and are intended for educational use rather than as a production compiler toolkit.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

compilerlab5-0.1.1.tar.gz (8.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

compilerlab5-0.1.1-py3-none-any.whl (10.8 kB view details)

Uploaded Python 3

File details

Details for the file compilerlab5-0.1.1.tar.gz.

File metadata

  • Download URL: compilerlab5-0.1.1.tar.gz
  • Upload date:
  • Size: 8.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.6

File hashes

Hashes for compilerlab5-0.1.1.tar.gz
Algorithm Hash digest
SHA256 94479c0639d253a3f512f30e63308e84e321368315568ee877eb18fdb183681f
MD5 60bbdd1efa35e57f2f37006b05379d9d
BLAKE2b-256 363a0f9ce7192674859890359c33fc333aac8a44d8f9a8a78083e3e8dc14332e

See more details on using hashes here.

File details

Details for the file compilerlab5-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: compilerlab5-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 10.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.6

File hashes

Hashes for compilerlab5-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 dddfdd968f950bb7144f226b1fe1a9eb2b953ed1ec2e5e96f50c13305ea7ac0d
MD5 13fdf5933b0866681e885ef8e8f50483
BLAKE2b-256 05a5145bb8c440ea95c4803c6feff64ee6009ddfc5c9961586a8f8772069da90

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page