Browse code

Add source code of the assembler compiler

Pawel Jablonski authored on 14/12/2022 19:04:16
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,49 @@
1
+/*
2
+ * Author: Pawel Jablonski
3
+ * E-mail: pj@xirx.net
4
+ * WWW: xirx.net
5
+ * GIT: git.xirx.net
6
+ *
7
+ * License: You can use this code however you like
8
+ * but leave information about the original author.
9
+ * Code is free for non-commercial and commercial use.
10
+ */
11
+
12
+#ifndef PARSER_H
13
+#define PARSER_H
14
+
15
+#include <QString>
16
+#include <QStringList>
17
+#include <QTextStream>
18
+#include <QList>
19
+#include <QRegularExpression>
20
+#include <QFile>
21
+#include <QFileInfo>
22
+#include <QSharedPointer>
23
+
24
+#include "codeitem.h"
25
+#include "codesection.h"
26
+#include "ramitem.h"
27
+#include "flashitem.h"
28
+#include "data.h"
29
+#include "datalist.h"
30
+
31
+//! This class parses all input source files for later compilation process
32
+class Parser
33
+{
34
+	public:
35
+		Parser(DataList &dataList);
36
+
37
+		bool parseFile(const QString &path);
38
+
39
+	private:
40
+		DataList &dataList; //!< List of data for each source file
41
+
42
+		bool parseMap(int i, const QString &mapPath, const QStringList &lineItems);
43
+
44
+		QSharedPointer<RamItem> parseRam(int i, QString &line);
45
+		QSharedPointer<FlashItem> parseFlash(int i, QString &line);
46
+		QSharedPointer<CodeItem> parseCode(int i, const QString &label, QString &line);
47
+};
48
+
49
+#endif