mirror of
https://github.com/notwa/lips
synced 2024-05-06 11:13:23 -07:00
update notes
This commit is contained in:
parent
2143128628
commit
29ae63ed34
48
NOTES.md
48
NOTES.md
|
@ -182,15 +182,12 @@ TODO
|
||||||
transforms complex statements into simpler statements
|
transforms complex statements into simpler statements
|
||||||
that Dumper can later understand.
|
that Dumper can later understand.
|
||||||
|
|
||||||
the name is a bit of a misnomer, because there's
|
|
||||||
very little processing after preprocessing. (see: `Dumper:load`)
|
|
||||||
|
|
||||||
the `:check` method
|
the `:check` method
|
||||||
asserts that a token exists and is of a given type (`tt`).
|
asserts that a token exists and is of a given type (`tt`).
|
||||||
it will defer to the `:lookup` method if the token type mismatches,
|
it will defer to the `:lookup` method if the token type mismatches,
|
||||||
which isn't guaranteed to help.
|
which isn't guaranteed to help.
|
||||||
|
|
||||||
preprocessing is split into two stages: process and expand; and four passes:
|
preprocessing is split into three passes:
|
||||||
|
|
||||||
### pass 1
|
### pass 1
|
||||||
|
|
||||||
|
@ -235,31 +232,30 @@ that the appropriate relative labels are found in the proper order.
|
||||||
|
|
||||||
attempts to parse and evaluate constant expressions.
|
attempts to parse and evaluate constant expressions.
|
||||||
|
|
||||||
### pass 4
|
### room for improvment
|
||||||
|
|
||||||
|
pass 3 (expressions) should be an attempt to evaluate constants,
|
||||||
|
and parsing should be moved to be part of pass 1.
|
||||||
|
|
||||||
|
looking back, the `new_statements` ordeal
|
||||||
|
only seems necessary for the (poor) error handling it provides.
|
||||||
|
|
||||||
|
the handling of statement tables could be made better.
|
||||||
|
|
||||||
|
## Expander
|
||||||
|
|
||||||
expands pseudo-instructions, including the inferrence of implied registers.
|
expands pseudo-instructions, including the inferrence of implied registers.
|
||||||
|
|
||||||
pseudo-instructions are defined in `overrides.lua`.
|
pseudo-instructions are defined in `overrides.lua`.
|
||||||
overrides act as extensions to the Preproc class;
|
overrides act as extensions to the Expander class;
|
||||||
they are passed Preproc's `self`.
|
they are passed Expander's `self`.
|
||||||
this keeps boilerplate out of `overrides.lua`,
|
this keeps boilerplate out of `overrides.lua`,
|
||||||
but makes our own file more of a mess,
|
but makes our own file more of a mess,
|
||||||
with more dependencies for arbitrary token/statement handling.
|
with more dependencies for arbitrary token/statement handling.
|
||||||
|
|
||||||
### room for improvment
|
### room for improvment
|
||||||
|
|
||||||
as noted above, the name is a bit of a misnomer,
|
expansion is kinda messy.
|
||||||
so this class should probably be split in two.
|
|
||||||
|
|
||||||
pass 3 (expressions) should be an attempt to evaluate constants,
|
|
||||||
and parsing should be moved to be part of pass 1.
|
|
||||||
|
|
||||||
pass 4 (expansion) is really messy.
|
|
||||||
|
|
||||||
looking back, the `new_statements` ordeal
|
|
||||||
only seems necessary for the (poor) error handling it provides.
|
|
||||||
|
|
||||||
the handling of statement tables could be made better.
|
|
||||||
|
|
||||||
## Expression
|
## Expression
|
||||||
|
|
||||||
|
@ -301,18 +297,20 @@ since Token objects contain all the data necessary to do so.
|
||||||
|
|
||||||
implements some error-checking for statements.
|
implements some error-checking for statements.
|
||||||
|
|
||||||
|
### TokenIter
|
||||||
|
|
||||||
|
used by Collector to iterate over statements, validating them.
|
||||||
|
|
||||||
### Reader
|
### Reader
|
||||||
|
|
||||||
inherited by stuff
|
used by Expander and Dumper to validate tokens in statements.
|
||||||
|
|
||||||
### Muncher
|
currently, this is the only class requiring inheritance.
|
||||||
|
|
||||||
inherited by stuff
|
|
||||||
|
|
||||||
### room for improvement
|
### room for improvement
|
||||||
|
|
||||||
Reader and Muncher classes shouldn't even be necessary;
|
Reader should probably be split into another class,
|
||||||
they could at least be reduced into one.
|
instead of inherited.
|
||||||
|
|
||||||
## etc.
|
## etc.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user