Add C backend - close #4

This commit is contained in:
josh committed 2023-08-24 09:40:01 -04:00
1 parent fff9700f91
commit 3c8794058f
30 files changed
+2292 -190

No files matched your search

+18
View File
@@ -0,0 +1,18 @@
#include "testparser.h"
#include <assert.h>
#include <string.h>
int main()
{
char const * input = "x";
p_context_t context;
p_context_init(&context, (uint8_t const *)input, strlen(input));
assert(p_parse(&context) == P_UNEXPECTED_INPUT);
input = "123";
p_context_init(&context, (uint8_t const *)input, strlen(input));
assert(p_parse(&context) == P_SUCCESS);
assert(p_result(&context) == 123u);
return 0;
}