From 88a8012eeb81be74a6bcaccfc514fd134a85c71a Mon Sep 17 00:00:00 2001 From: Kai Stevenson Date: Mon, 12 Jun 2023 03:19:31 -0700 Subject: added some comments, added a license and a readme --- parse.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'parse.c') diff --git a/parse.c b/parse.c index d7ec467..d26cfe8 100644 --- a/parse.c +++ b/parse.c @@ -50,6 +50,7 @@ line_t parse_line(char* content) { } prop_t parse_proposition(tokenSet_t tokenSet, int* seek) { prop_t prop; + /* recurse to parse the parenthetical as its own proposition */ if (tokenSet.tokens[*seek].type == OPEN_PAREN) { (*seek)++; prop = parse_proposition(tokenSet, seek); @@ -63,6 +64,7 @@ prop_t parse_proposition(tokenSet_t tokenSet, int* seek) { return prop; } else { + /* the proposition we just read had a relation, so find the related proposition */ tokenType_t rel = tokenSet.tokens[*seek].type; (*seek)++; prop_t* prop1p = malloc(sizeof(prop_t)); @@ -80,6 +82,7 @@ just_t parse_justification(tokenSet_t tokenSet) { } justRule_t just; int* references = malloc(sizeof(int) * (tokenSet.count - 2)); + /* check the relation, then use a ternary operator for elim/intro */ switch (tokenSet.tokens[0].type) { case CONJUNCTION: just = tokenSet.tokens[1].type == ELIMINATION ? CONJUNCT_ELIM : CONJUNCT_INTRO; -- cgit v1.3.1