Skip to main content

hera-py

Build Status Coverage Status PyPI

A toolkit for the Haverford Educational RISC Architecture (HERA) assembly language, comprising an interpreter, a debugger, an assembler, and a disassembler.

Installation

You can install hera-py with pip:

$ pip3 install hera-py

Usage

After installation, use the hera command to run a HERA program:

$ hera main.hera

Enter the interactive debugger with the debug subcommand:

$ hera debug main.hera

Assemble a HERA program into machine code:

$ hera assemble main.hera

Disassemble machine code back into the human-readable HERA syntax:

$ hera disassemble main.hera.lcode

You can also preprocess a HERA program without running it, to see how pseudo-instructions and labels are resolved to HERA code:

$ hera preprocess main.hera

Comparison with HERA-C and Hassem

HERA-C is the current HERA interpreter used at Haverford. It is implemented as a shell-script wrapper around a set of C++ macros that expand HERA instructions into C++ code, which is then compiled by g++.

hera-py improves on HERA-C in the following areas:

  • Includes a purpose-built HERA debugger
  • Concise and accurate error messages
  • Ease of use
    • Cross-platform and easy to install
    • Configurable with command-line options
    • Does not create temporary files
    • Command name has six fewer letters than HERA-C-Run

hera-py also supports several features that HERA-C does not:

  • Setting registers to the value of a label
  • Detecting stack overflow
  • Multi-precision multiplication
  • Relative branching by a fixed integer value (e.g., BRR(10))
  • Branching by the value of a register (e.g., SET(R1, 20); BR(R1))
  • Detecting invalid relative branches

HERA-C has a few features that hera-py does not:

  • C-style #define macros (and more generally the ability to embed arbitrary C++ code in HERA programs)

Small to medium-sized programs generally run faster with hera-py than with HERA-C, while very large programs are typically faster with HERA-C.

Hassem is the current HERA assembler used at Haverford. hera-py has better error messages than Hassem, allows the user greater control of output (e.g., with the --stdout flag), and fixes some Hassem bugs.

Acknowledgements

Thank you to Christopher Villalta for valuable feedback on early iterations of this project.

Metadata

Release files for hera-py 1.0.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hera-py 1.0.7
File Size Uploaded
hera-py-1.0.7.tar.gz 85.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for hera-py 1.0.7
File Interpreter ABI Platform
hera_py-1.0.7-py3-none-any.whl Python 3 none any Details

Total release size: 229.2 kB

Release files / hera-py-1.0.7.tar.gz

Download URL hera-py-1.0.7.tar.gz
Size 85.0 kB
Tags Source
SHA-256 checksum
How to use checksums
9c816a7e6895ef1bfe0b3294f1970849ceb8d97955001a41af6c914ffaf76c1e
BLAKE2b-256 checksum
How to use checksums
4d1f55b387e8b92a57bd79985b56dae36711637bf99d6dbe07eecc80686ffd76
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.22.0 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.9

Release files / hera_py-1.0.7-py3-none-any.whl

Download URL hera_py-1.0.7-py3-none-any.whl
Size 144.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b216dac9c260e23d95785b11d297b25f31a1b6211803d86cb5e3be2fe15bbc9c
BLAKE2b-256 checksum
How to use checksums
db798ba4e4c40d482c9be7012fd764c8eb10303bb449405a403fc2bccb8f2204
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.22.0 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.9

Release history Release notifications | RSS feed

This release

1.0.7 This release

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.8.1

2 release files

0.8.0

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1.0

2 release 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