Commit graph

193 commits

Author SHA1 Message Date
I-Al-Istannen
acb49552ed Implement subphase5 and complete phase1To2
The program is now able to read simple asm programs and convert them to
a MimaState.
2020-04-08 20:33:51 +02:00
I-Al-Istannen
12801c5627 Fix optional argument parsing
As `optional` does not backtrack, the parser would get stuck in its ways
if it could parse spaces after an instruction without any argument:
```
NOT    ; Comment
```
An explicit try was added to backtrack and not fail the parse.
2020-04-08 20:28:57 +02:00
I-Al-Istannen
dd71e3a84c Remove debug method from subphase4 2020-04-08 20:08:57 +02:00
I-Al-Istannen
d35de03936 Fix address assignment in subphase2 2020-04-08 16:49:06 +02:00
I-Al-Istannen
7f6e987c33 Implement subphase4 2020-04-08 16:29:50 +02:00
cc6dadfd3e Implement subphase 3
Also...
- Parse .meta-global correctly
- Keep .meta until subphase 3
- Add identity functions for some phase 2 types
- Minor clean ups
2020-04-05 15:59:56 +00:00
6e1f3e213c Switch Span to offsets 2020-04-05 13:44:50 +00:00
b85ff076ba Clean up file structure 2020-04-05 11:25:16 +00:00
52da9f0507 Run stylish-haskell on all files 2020-04-05 11:12:58 +00:00
ff9b7a35c7 Split up phase 1 into multiple modules 2020-04-05 11:12:53 +00:00
8d0e70cf5d Split up phase 2 into multiple modules 2020-04-05 10:10:19 +00:00
I-Al-Istannen
d82ce69b1b Add proper relative and label-relative addresses 2020-04-04 17:32:05 +02:00
e942544044 Add Show instance for WeedError 2020-04-04 13:42:16 +00:00
86dd243c11 Allow '_' in label and meta names 2020-04-04 13:42:16 +00:00
c8b53d1a1f Attempt to clean up subphase 2 2020-04-04 13:16:39 +00:00
I-Al-Istannen
2d4d932c41 WIP: Add rough untested Phase2 conversion pass 2020-04-04 01:06:40 +02:00
b98fe04bbc Clean up phase 2 and add a few missing things 2020-04-03 20:06:24 +00:00
96c28c1f31 Attempt to clean up phase 2 2020-04-03 16:59:26 +00:00
5fe7b26daf Add phase2 types and conversion from phase 1 2020-04-03 01:58:54 +00:00
bc52fafe63 Derive functors for pretty much all phase 1 types 2020-04-03 01:15:35 +00:00
0fea2b960a Introduce WeedError
This change is meant to make working with an unspecified 's' type parameter
easier.
2020-04-03 01:13:58 +00:00
f25099d6f3 Add back Weed monad
Make weed monad compatible with all sorts of parsers instead of requiring a
Parsec T.Text Void.
2020-04-02 14:23:28 +00:00
7bb74f7315 Add back show instance for Span 2020-04-02 11:15:54 +00:00
4f29ee4fff Clean up and fix formatting code 2020-04-01 20:40:12 +00:00
I-Al-Istannen
f6859ae578 Add garbage ASM format methods 2020-04-01 21:52:24 +02:00
I-Al-Istannen
1effa96a17 Fix "toDec" including the constructor name 2020-04-01 21:49:31 +02:00
I-Al-Istannen
9e544a64f3 Finish Asm parser (for now) 2020-04-01 12:45:02 +02:00
I-Al-Istannen
2882a2c42e Parse instructions without arguments 2020-03-31 16:06:15 +02:00
I-Al-Istannen
813d891468 Do not partially parse a file 2020-03-31 15:31:36 +02:00
I-Al-Istannen
300ef6e0c0 Make TokenLabel a declaration 2020-03-31 15:27:00 +02:00
I-Al-Istannen
7ee414bbb3 Add simple phase1 parser 2020-03-31 15:22:36 +02:00
I-Al-Istannen
a540e1711a Add a comment and asmToken parser 2020-03-31 15:04:12 +02:00
I-Al-Istannen
7c02901b64 Fix ".meta" and ".meta-start" directives using the same keyword 2020-03-31 12:06:05 +02:00
I-Al-Istannen
5bfd2e4357 Fix address and number parser
* The order in the address parser was wrong

* The signed number *optionally* required a sign. Due to this every
  address was relative. Now the `signedNumber` *required* a sign and the
  previous behaviour was renamed to `optionallySignedNumber`.
2020-03-31 12:03:52 +02:00
I-Al-Istannen
f96f088eba Add nicer Show instance for Span 2020-03-31 12:03:24 +02:00
I-Al-Istannen
b226372ba7 Implement directive parser 2020-03-30 23:36:22 +02:00
ada200bf50 Partially implement phase 1 parsing
This commit introduces a few --pedantic warnings. Those will (hopefully) be
fixed in the next commit.
2020-03-30 18:57:24 +00:00
b15606a530 Create types for assembly phase 1 2020-03-30 14:54:43 +00:00
b9f9d27105 Catch and print all IOErrors 2020-03-29 11:39:20 +00:00
7b7a363693 Use package for modifying paths 2020-03-29 11:12:44 +00:00
I-Al-Istannen
fdc755ecb0 Load metadata file if it exists 2020-03-29 11:12:41 +00:00
I-Al-Istannen
d0807d575a Add metadata file to Options 2020-03-29 11:12:38 +00:00
564bc44d51 Respect flags during execution 2020-03-28 19:49:45 +00:00
7397a0fecd Clean up 2020-03-28 19:32:21 +00:00
I-Al-Istannen
e4a8fb2747 Add tests for Flags 2020-03-28 20:18:29 +01:00
I-Al-Istannen
d3ba3355e4 Fix nested ranges not overwriting their parents 2020-03-28 20:18:06 +01:00
I-Al-Istannen
66efb97205 Ignore hie setup file 2020-03-28 19:28:43 +01:00
I-Al-Istannen
caf9a896d8 Add flag data structure and conversion 2020-03-28 17:46:41 +01:00
69983fc9ed Test Mima.Vm.Instruction 2020-03-27 23:19:39 +00:00
6b81fd67b4 Implement basic mima-run functionality
Bugs fixed:
- Print correct file name when load/save error occurs
- Correctly identify invalid file formats
2020-03-27 22:10:59 +00:00