Update parser
This commit is contained in:
@@ -35,4 +35,9 @@ bash build.c
|
||||
- [x] Basic types (int, double, string, bool, char)
|
||||
- [ ] Advanced types (fun(...), template(...), object(...))
|
||||
- [x] Lex identifiers
|
||||
|
||||
- [ ] Parser
|
||||
- [x] Create structure to hold nodes
|
||||
- [ ] Start parsing tree
|
||||
- [ ] (this will be updated soon)
|
||||
|
||||
|
||||
2
build.c
2
build.c
@@ -40,7 +40,7 @@ exit
|
||||
|
||||
// -- PARSER --
|
||||
#include "src/parser/SolsNode.c"
|
||||
|
||||
#include "src/parser/parser.c"
|
||||
|
||||
// -- CODEGEN --
|
||||
|
||||
|
||||
5
src/parser/parser.c
Normal file
5
src/parser/parser.c
Normal file
@@ -0,0 +1,5 @@
|
||||
#include "parser.h"
|
||||
|
||||
ResultType(SolsParser, charptr) createSolsParser(SolsTokens* input) {
|
||||
return Error(SolsParser, charptr, "Work in progress");
|
||||
}
|
||||
@@ -2,5 +2,27 @@
|
||||
#define PARSER_H
|
||||
|
||||
#include "SolsNode.h"
|
||||
#include "../lexer/SolsToken.h"
|
||||
#include "../include/error.h"
|
||||
|
||||
// Holds information about the parser.
|
||||
// .input is lexed tokens, produced by a lexer.
|
||||
// .current is the token currently being parsed.
|
||||
// .output is the final product of the parser.
|
||||
// .currentParent points to the current node being processed
|
||||
typedef struct SolsParser {
|
||||
SolsTokens* input;
|
||||
size_t current;
|
||||
SolsNode output;
|
||||
SolsNode* currentParent;
|
||||
} SolsParser;
|
||||
|
||||
Result(SolsParser, charptr);
|
||||
|
||||
// Creates a SolsParser.
|
||||
// Returns:
|
||||
// Success: Constructed SolsParser
|
||||
// Failure: char* detailing what went wrong (usually memory failure)
|
||||
ResultType(SolsParser, charptr) createSolsParser(SolsTokens* input);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user