Age | Commit message (Collapse) | Author |
|
Much simpler, uses a switch case which is a much faster method of
doing the parsing. Though roughly equivalent in terms of LOC, I feel
that this is more extensible
|
|
More useful tokens, in particular for each opcode possible. This
makes parsing a simpler task to reason as now we're just checking
against an enum rather than doing a string check in linear time.
It makes more sense to do this at the tokeniser as the local data from
the buffer will be in the cache most likely as the buffer is
contiguously allocated. While it will always be slow to do linear
time checks on strings, when doing it at the parser we're having to
check strings that may be allocated in a variety of different places.
This means caching becomes a harder task, but with this approach we're
less likely to have cache misses as long as the buffer stays there.
|
|
As strto(ul|ll) allow the parsing of hex literals of the form `0x`, we
allow lexing of hex literals which start with `x`.
They're lexed into C hex literals which work for strtol.
|
|
|
|
As it has no dependencies on vm specifically, and it's more necessary
for any vendors who wish to target the virtual machine, it makes more
sense for inst to be a lib module rather than a vm module.
|
|
|
|
Currently only for invalid character literals, but still a possible
problem.
|
|
Just takes the character literally as a number.
|
|
|
|
Prints useful and pretty messages when verbose being at least 1.
|
|
Pretty simple implementation, I've stopped printing the tokens cos I
think the lexer is done.
|
|
Introduced some functions to parse differing types of opcodes. Use
the same style of a.b.c... for namespacing or type specification for
certain opcodes. Bit hacky and not tested, but does work.
Parse errors can be reported with an exact location using the token
column, line.
|
|
Easier to do it here than at the parser.
|
|
Accurate error reporting can be introduced using this.
|
|
Just prints instructions so far.
|
|
|
|
Though we deal with unsigned numbers internally, it should be possible
to read and manipulate negative numbers through 2s complement. Later
on we'll add support for signed operations via 2s complement, so this
should be allowed.
|
|
|
|
|
|
|
|
|
|
No implementations yet
|
|
|
|
Pretty simple tokeniser, doesn't do a lot and needs to error check better.
|
|
|