Expand description
§Formats Module
Provides support for parsing, generating, and manipulating various file formats (such as Java Class files, JASM assembly files, etc.).
§Overview
This module is a core component of the JVM assembler, responsible for handling input and output of different formats. It provides a unified set of interfaces for:
- Parsing: Parsing files in specific formats (such as
.classor.jasmfiles) into internal representations. - Generation: Converting internal representations back into specific format files.
- Manipulation: Providing structured access and modification capabilities for these formats.
§Core Features
§Java Class File Format (class sub-module)
- Parse
.classfiles: Parse binary.classfiles into aJvmClassstructure. - Generate
.classfiles: SerializeJvmClassstructures into binary.classfiles. - Structured Access: Provide access interfaces to components such as the constant pool, fields, methods, attributes, etc.
§JASM Assembly File Format (jasm sub-module)
- Parse
.jasmfiles: Parse text-based.jasmassembly files into aJvmProgramstructure. - Generate
.jasmfiles: DisassembleJvmProgramstructures into text-based.jasmfiles. - Syntax Checking: Provide validation and error reporting for JASM syntax.
§Usage Example
§Parsing a Class File
§Generating a JASM File
§Error Handling
Parsing and generation functions in the module typically return Result<T, E>, where E is an error type containing detailed error information, such as ClassFileError or JasmError.