System Programming and Compiler Construction tools and experiments
Project description
SPCC Tools
A Python package containing implementations of System Programming and Compiler Construction experiments.
Installation
pip install spcc-tools
Features
This package includes the following experiments:
- Two Pass Assembler - Implementation of Pass 1 of a Two Pass Assembler
- MACRO Expansion - Program to define a MACRO without arguments and expand MACRO calls
- FOLLOW Computation - Program to compute FOLLOW sets for a Context-Free Grammar (CFG)
- FIRST Computation - Program to compute FIRST sets for a Context-Free Grammar (CFG)
- Lexical Analysis - Program to count characters, words, sentences, lines, tabs, numbers, and blank spaces using LEX
Usage
Two Pass Assembler
from spcc_tools.assembler.two_pass import pass_one
# Example usage
result = pass_one(input_file_path)
print(result)
Or use the command-line interface:
spcc-assembler input_file.asm
MACRO Expansion
from spcc_tools.macro.expander import expand_macro
# Example usage
expanded_code = expand_macro(input_file_path)
print(expanded_code)
Or use the command-line interface:
spcc-macro input_file.txt
FOLLOW Computation
from spcc_tools.cfg.follow import compute_follow
# Example usage
grammar = {
'S': ['AB', 'BC'],
'A': ['a'],
'B': ['b'],
'C': ['c']
}
follow_sets = compute_follow(grammar, 'S')
print(follow_sets)
Or use the command-line interface:
spcc-follow grammar_file.txt
FIRST Computation
from spcc_tools.cfg.first import compute_first
# Example usage
grammar = {
'S': ['AB', 'BC'],
'A': ['a'],
'B': ['b'],
'C': ['c']
}
first_sets = compute_first(grammar)
print(first_sets)
Or use the command-line interface:
spcc-first grammar_file.txt
Lexical Analysis Counter
from spcc_tools.lexical.counter import count_elements
# Example usage
result = count_elements(input_text)
print(result)
Or use the command-line interface:
spcc-lexcount input_file.txt
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file spcc_tools-0.1.0.tar.gz.
File metadata
- Download URL: spcc_tools-0.1.0.tar.gz
- Upload date:
- Size: 11.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ad86a9b3c68627e0efcae38bb2d3fb92d516e907e33872d0b5669f63a1acccce
|
|
| MD5 |
29a98fc2980ee29ddddc108c1713802d
|
|
| BLAKE2b-256 |
8be0eb1b6dd1cf3a03aeaaf2186aac2d0c399576ae1b48ce27da41200c143fa6
|
File details
Details for the file spcc_tools-0.1.0-py3-none-any.whl.
File metadata
- Download URL: spcc_tools-0.1.0-py3-none-any.whl
- Upload date:
- Size: 14.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aa14552aa448505ed9ce4185453e6fdff727ac1e1df53ffdb3c7ff9afb29bfd6
|
|
| MD5 |
cc3efa3ff91f7e65c7eaf4007325fcc9
|
|
| BLAKE2b-256 |
2efa0a97a180645e5fe5d6c37d5f4dfc2669972248e006b9d278e46bcc3f3aa0
|