parser working, needs more tests and an actual language to make sure that is true though

This commit is contained in:
herbglitch 2024-11-20 10:27:17 -07:00
parent 63dfb98aad
commit 606f8e4bad
10 changed files with 365 additions and 148 deletions

View file

@ -2,6 +2,7 @@
#include "arc/std/lexer.h"
#include "arc/std/parser.h"
#include "arc/std/string.h"
#include <stddef.h>
void ARC_ParserLang_InitLexerRulesFn(ARC_Lexer *lexer){
//null
@ -75,19 +76,19 @@ void ARC_Parser_CreateAsParserLang(ARC_Parser **parser){
uint32_t *alphaChar[] = { (uint32_t[]){ 1, ARC_PARSERLANG_TOKEN_ALPHA_LOWER_CHAR }, (uint32_t[]){ 1, ARC_PARSERLANG_TOKEN_ALPHA_UPPER_CHAR }};
ARC_ParserLanguageTag parserLangTags[13] = {
{ ARC_PARSERLANG_LINE , line , 4 },
{ ARC_PARSERLANG_BODY , body , 1 },
{ ARC_PARSERLANG_ARGUMENTS , arguments , 2 },
{ ARC_PARSERLANG_ARGUMENT , argument , 2 },
{ ARC_PARSERLANG_TAG_OR_CONSTANT, tagOrConstant, 2 },
{ ARC_PARSERLANG_CONSTANT , constant , 1 },
{ ARC_PARSERLANG_CONSTANT_BODY , constantBody , 2 },
{ ARC_PARSERLANG_CONSTANT_CHAR , constantChar , 2 },
{ ARC_PARSERLANG_TAG , tag , 1 },
{ ARC_PARSERLANG_VARIABLE , variable , 2 },
{ ARC_PARSERLANG_VARIABLE_BODY , variableBody , 2 },
{ ARC_PARSERLANG_VARIABLE_CHAR , variableChar , 3 },
{ ARC_PARSERLANG_ALPHA_CHAR , alphaChar , 2 }
{ ARC_PARSERLANG_LINE , line , 4, NULL },
{ ARC_PARSERLANG_BODY , body , 1, NULL },
{ ARC_PARSERLANG_ARGUMENTS , arguments , 2, NULL },
{ ARC_PARSERLANG_ARGUMENT , argument , 2, NULL },
{ ARC_PARSERLANG_TAG_OR_CONSTANT, tagOrConstant, 2, NULL },
{ ARC_PARSERLANG_CONSTANT , constant , 1, NULL },
{ ARC_PARSERLANG_CONSTANT_BODY , constantBody , 2, NULL },
{ ARC_PARSERLANG_CONSTANT_CHAR , constantChar , 2, NULL },
{ ARC_PARSERLANG_TAG , tag , 1, NULL },
{ ARC_PARSERLANG_VARIABLE , variable , 2, NULL },
{ ARC_PARSERLANG_VARIABLE_BODY , variableBody , 2, NULL },
{ ARC_PARSERLANG_VARIABLE_CHAR , variableChar , 3, NULL },
{ ARC_PARSERLANG_ALPHA_CHAR , alphaChar , 2, NULL }
};
ARC_Array parserLanguageArray = {
@ -95,5 +96,6 @@ void ARC_Parser_CreateAsParserLang(ARC_Parser **parser){
parserLangTags //data
};
ARC_Parser_Create(parser, &parserLanguageArray, ARC_ParserLang_InitLexerRulesFn);
//TODO: add the create, destroy, and add callbacks
ARC_Parser_Create(parser, &parserLanguageArray, ARC_ParserLang_InitLexerRulesFn, NULL, NULL);
}