Safe Haskell | None |
---|---|
Language | Haskell2010 |
Data.TI85.Parsers
Description
This module contains the highest-level user-facing functions.
Typically, code using this library will want to call readTIFile
on a file name.
Synopsis
- readTIFile :: FilePath -> IO TIFile
- parseTIHeader :: Parser TIHeader
- parseTIFile :: Parser TIFile
- parseTIBackupHeader :: Parser TIBackupHeader
- readUserMem :: Word16 -> VarTable -> ByteString -> [Variable]
- readVarMem :: Word16 -> VarTableEntry -> ByteString -> Variable
- extractVar :: Word16 -> VarTableEntry -> Parser Variable
- readVariable :: TIVar -> Variable
- parseVariable :: VarType -> Parser Variable
- parseProgram :: Parser Program
- parseTINumber :: Parser TINumber
- parseToken :: Parser Token
General TI Files
readTIFile :: FilePath -> IO TIFile Source #
Read a general TI file, which might be a variable file or backup file.
parseTIHeader :: Parser TIHeader Source #
The TI-85 header is common between backup files and variable files.
8 Byte | 3 | 42 Byte |
---|---|---|
**TI85** | xyz | Comment |
where xyz
is always 0x1a,0x0c,0x00
.
parseTIFile :: Parser TIFile Source #
Parse a general TI file, which might be a variable file or backup file.
Backup Files
High-level Parsers
parseTIBackupHeader :: Parser TIBackupHeader Source #
The backup header is a second header after
the top-level file header (TIFile
).
It contains sizes of the three data sections
and the location of user memory in RAM (which
can use used with the variable table to look
up variable data).
readUserMem :: Word16 -> VarTable -> ByteString -> [Variable] Source #
Read all ofthe variables contained in a user memory backup, according to a variable table.
Lower-level Parsers
readVarMem :: Word16 -> VarTableEntry -> ByteString -> Variable Source #
Given a bytestring of user memory, look up the variable
table entry and return a Variable
.
extractVar :: Word16 -> VarTableEntry -> Parser Variable Source #
Parse a variable out of user memory, without consuming any input (hence "extract"). This allows many calls on the same memory. The base address is required for converting the variable addresses in the table to offsets into the user memory backup.
Variable Files
High-level Parsers
readVariable :: TIVar -> Variable Source #
Convert raw variable data into a Variable.
parseVariable :: VarType -> Parser Variable Source #
Parser for the elements contained a variable file that has possibly more than one
Lower-level Parsers
parseProgram :: Parser Program Source #
Programs are either plain text, ot encoded in a tokenized format. See Data.TI85.Token for the mapping.
parseTINumber :: Parser TINumber Source #
Numeric values can either be real or complex, and most variable types can store either.
parseToken :: Parser Token Source #
Interpret data as a token (or token stream)