CS3501 Compiler Design Lab
Install with python -m pip install cdex after publication. To install from the extracted project before publication, run python -m pip install ..
import cdex
print(cdex.ex2()) # creates ex2/lexer.l and ex2/input.c
print(cdex.ex3("my_calculator")) # writes calc.l and calc.y to my_calculator/
Each function writes the bundled text files and returns a list of paths. Use a fresh destination when a filename already exists. Python 3.9 or later is required. To compile the exported sources on Ubuntu, install GCC, Flex and Bison. Run each command from the corresponding exported directory.
| Function | Experiment | Ubuntu command |
|---|---|---|
ex1() |
C lexical analyzer | gcc tokens.c -o tokens && ./tokens |
ex2() |
Lex lexical analyzer | flex lexer.l && gcc lex.yy.c -o lexer && ./lexer < input.c |
ex3() |
Lex/Yacc calculator (3d) | yacc -d calc.y && flex calc.l && gcc y.tab.c lex.yy.c -o calc && ./calc |
ex4() |
Three-address code | yacc -d tac.y && flex tac.l && gcc y.tab.c lex.yy.c -o tac && ./tac |
ex5() |
Type checking | yacc -d type.y && flex type.l && gcc y.tab.c lex.yy.c -o type && ./type |
ex6() |
Code optimization | gcc optimize.c -o optimize && ./optimize |
ex7() |
8086 code generator | gcc backend.c -o backend && ./backend |
Publish directly to PyPI
From the extracted folder containing pyproject.toml, run:
python -m pip install --upgrade twine
python -m twine check dist/*
python -m twine upload --repository-url https://upload.pypi.org/legacy/ --username __token__ dist/*
Enter your PyPI API token at the hidden password prompt. The included distributions are already built. If you edit the source, rebuild in a clean dist directory with python -m pip install build and python -m build before uploading.
Metadata
Release files for cdex 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cdex-0.1.0.tar.gz | 7.3 kB | Without provenance | Details for cdex-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cdex-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for cdex-0.1.0-py3-none-any.whl |
Total release size: 16.3 kB
Release files / cdex-0.1.0.tar.gz
| Download URL | cdex-0.1.0.tar.gz |
|---|---|
| Size | 7.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8fde100503f74afe2519f4115505c2e3016be0d66ad31734cde388a4fc722f6c
|
|
BLAKE2b-256 checksum How to use checksums |
95c8dc527049a2c392c2af81ed893705ef8afbdeecf032254b731c12385431ef
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / cdex-0.1.0-py3-none-any.whl
| Download URL | cdex-0.1.0-py3-none-any.whl |
|---|---|
| Size | 9.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ed6c1310e9f4e81a3dcf57a8a70d655d0e6902ece5ffc8a23c2555e82e9975b1
|
|
BLAKE2b-256 checksum How to use checksums |
0e8fe10872175205568986e2a86c36d14f74eb0eb25ffdb92670cea8d0859e19
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Security for cdex 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.