summaryrefslogtreecommitdiff
path: root/head
diff options
context:
space:
mode:
Diffstat (limited to 'head')
-rw-r--r--head/atas/lexer.h22
-rw-r--r--head/atas/parser.h20
-rw-r--r--head/atas/token.h37
3 files changed, 79 insertions, 0 deletions
diff --git a/head/atas/lexer.h b/head/atas/lexer.h
new file mode 100644
index 0000000..5944825
--- /dev/null
+++ b/head/atas/lexer.h
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) 2026, Apollo Telephone Laboratories.
+ * Provided under the BSD-3 clause.
+ */
+
+#ifndef ATAS_LEXER_H
+#define ATAS_LEXER_H 1
+
+#include <atas/token.h>
+#include <atas/state.h>
+
+/*
+ * Scan for a single lexical element within a program
+ *
+ * @state: ATAS state
+ * @token: Token result is written here
+ *
+ * Returns zero on success
+ */
+int atas_lexer_scan(struct atas_state *state, struct atas_token *token);
+
+#endif /* !ATAS_LEXER_H */
diff --git a/head/atas/parser.h b/head/atas/parser.h
new file mode 100644
index 0000000..7e410c8
--- /dev/null
+++ b/head/atas/parser.h
@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) 2026, Apollo Telephone Laboratories.
+ * Provided under the BSD-3 clause.
+ */
+
+#ifndef ATAS_PARSER_H
+#define ATAS_PARSER_H 1
+
+#include <atas/state.h>
+
+/*
+ * Begin parsing the input source file
+ *
+ * @state: ATAS state machine
+ *
+ * Returns zero on success
+ */
+int atas_parse(struct atas_state *state);
+
+#endif /* !ATAS_PARSER_H */
diff --git a/head/atas/token.h b/head/atas/token.h
new file mode 100644
index 0000000..1346eba
--- /dev/null
+++ b/head/atas/token.h
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2026, Apollo Telephone Laboratories.
+ * Provided under the BSD-3 clause.
+ */
+
+#ifndef ATAS_TOKEN_H
+#define ATAS_TOKEN_H 1
+
+#include <sys/types.h>
+#include <stdint.h>
+#include <stddef.h>
+
+/*
+ * Token type
+ */
+typedef enum {
+ TT_NONE, /* [NONE] */
+ TT_COMMA, /* ',' */
+ TT_MAX
+} atas_tt_t;
+
+/*
+ * Represents a single lexical element within a program
+ *
+ * @type: Token type
+ * @c: Character associated with token
+ * @v: Signed value associated with token
+ */
+struct atas_token {
+ atas_tt_t type;
+ union {
+ char c;
+ ssize_t v;
+ };
+};
+
+#endif /* !ATAS_TOKEN_H */