From 6bed98370802407cb8611bf41cf9e1b1c3668538 Mon Sep 17 00:00:00 2001 From: Vank143 <78201359+Vank143@users.noreply.github.com> Date: Mon, 21 Jun 2021 17:18:43 +0200 Subject: [PATCH 1/5] Update lexer.c --- lexer.c | 64 +++++++++++++++++++++++---------------------------------- 1 file changed, 26 insertions(+), 38 deletions(-) diff --git a/lexer.c b/lexer.c index 6a45097..c7fe20f 100644 --- a/lexer.c +++ b/lexer.c @@ -38,7 +38,7 @@ int endExploration(Exploration *exploration) return 1; } else { - return 0; + return -1; } } @@ -101,50 +101,46 @@ int execute(Node *node, Exploration *in) { switch (node->type) { case STRING: { + int pos= in->position; for (int i=0; i < strlen(node->stringValue);i++) { if (advance(in) != node->stringValue[i]) { + setPosition(in, pos); return 0; } } - if (endExploration(in)==1) - { - return 1; - } else - { - return -1; - } + return endExploration(in); } case AND: { + int pos= in->position; if (execute(node->children[0], in) == 0) //si il y a eu une erreur { + setPosition(in, pos); return 0; } else //si ça s'est bien passé { - return execute(node->children[1], in); + int result= execute(node->children[1], in); + if (result == 0) { + setPosition(in, pos); + } + return result; } } case STAR: { - if(execute(node->children[0], in) == 1){ - execute(node->children[0], in); - } - else return 1; + int pos= in->position; + int result; + while ((result= execute(node->children[0], in)) == -1){ + pos= in->position;; + } + if (result == 0) { + setPosition(in, pos); + } + return endExploration(in); } case PLUS: { - if(execute(node->children[0],in)==0){ - return 0; - } - else{ - while(execute(node->children[0], in) == 1){ - - execute(node->children[0], in); - - } - return 1; - - } - + Node *newNode= mkAnd(node->children[0], mkStar(node->children[0])); + return execute(newNode,in); } } printf("this cannot happen\n"); @@ -158,7 +154,6 @@ int main(int argc, char **argv) /*Node *program= mkString("aabbcc"); - Node *program= mkAnd(mkString("aab"), mkString("bcc"));*/ @@ -168,16 +163,11 @@ int main(int argc, char **argv) mkAnd(mkString("bb"), mkString("cc")));*/ - /* Node *program= - mkAnd( mkString("aabbcc"), - mkAnd(mkStar(mkString("c")), // "a"*"b"*"c"* - mkAnd(mkStar(mkString("b")), - mkStar(mkString("c"))))); -*/ - Node *program= + Node *program= mkAnd(mkPlus(mkString("a")), // "a"*"b"*"c"* - mkAnd(mkPlus(mkString("b")), - mkPlus(mkString("c")))); + mkAnd(mkStar(mkString("b")), + mkStar(mkString("c")))); + if (execute(program, in)<=0) { @@ -193,11 +183,9 @@ int main(int argc, char **argv) /*Input *in1= mkInput("hello"); Input *in2= mkInput("world"); Input *in3= mkInput("hello world"); - Node *program= mkOr(mkString("hello"), // "hello" | "world" mkString("world")); - printf("%i\n", execute(program, in)); // 0 => no match, 1 => match*/ From bb4d7f531bd7f64ced6922202bebe28399867c35 Mon Sep 17 00:00:00 2001 From: Vank143 <78201359+Vank143@users.noreply.github.com> Date: Tue, 22 Jun 2021 13:54:07 +0200 Subject: [PATCH 2/5] Update lexer.c --- lexer.c | 179 ++++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 122 insertions(+), 57 deletions(-) diff --git a/lexer.c b/lexer.c index c7fe20f..d96b605 100644 --- a/lexer.c +++ b/lexer.c @@ -9,8 +9,13 @@ typedef struct Exploration Exploration; enum opcode { STRING, AND, + OR, STAR, - PLUS + PLUS, + CLASS, + QUESTION_MARK, + EXCLAMATION_MARK, + DOT }; struct Exploration { @@ -26,27 +31,34 @@ Exploration *mkExploration(char *text) return exploration; } -char advance(Exploration *exploration) +void advance(Exploration *exploration, int add) { - return exploration->text[exploration->position++]; + exploration->position+= add; } -int endExploration(Exploration *exploration) -{ - if (exploration->position >= strlen(exploration->text)) - { - return 1; - } else - { - return -1; +int atEnd(Exploration *exploration) { + return exploration->text[exploration->position] == 0; } -} void setPosition(Exploration *exploration, int position) { exploration->position= position; } +int getPosition(Exploration *exploration) { + return exploration->position; +} + +int currentChar(Exploration *exploration) +{ + return exploration->text[exploration->position]; +} + +char *currentText(Exploration *exploration) +{ + return exploration->text + exploration->position; +} + struct Node { @@ -96,51 +108,112 @@ Node *mkPlus(Node *child) return node; } +Node *mkOr(Node *node1, Node *node2) +{ + Node *node= mkNode(OR); + node->children[0]= node1; + node->children[1]= node2; + return node; +} + +Node *mkClass(char* str) +{ + Node *node= mkNode(CLASS); + node->stringValue= str; + return node; +} + +Node *mkQuestionMark(Node *child) +{ + Node *node= mkNode(QUESTION_MARK); + node->children[0]= child; + return node; +} + +Node *mkExclamationMark(Node *child) +{ + Node *node= mkNode(EXCLAMATION_MARK); + node->children[0]= child; + return node; +} + +Node *mkDot() +{ + Node *node= mkNode(DOT); + return node; +} + + + int execute(Node *node, Exploration *in) { switch (node->type) { case STRING: { - int pos= in->position; - for (int i=0; i < strlen(node->stringValue);i++) - { - if (advance(in) != node->stringValue[i]) - { - setPosition(in, pos); - return 0; - } + int length= strlen(node->stringValue); + if (strncmp(currentText(in), node->stringValue, length)) { + return 0; } - return endExploration(in); + advance(in, length); + return 1; } case AND: { - int pos= in->position; - if (execute(node->children[0], in) == 0) //si il y a eu une erreur + int pos= getPosition(in); + if (!execute(node->children[0], in)) //si il y a eu une erreur { + return 0; + } //si ça s'est bien passé + if (!execute(node->children[1], in)) { setPosition(in, pos); return 0; - } else //si ça s'est bien passé - { - int result= execute(node->children[1], in); - if (result == 0) { - setPosition(in, pos); - } - return result; } + return 1; } - case STAR: { - int pos= in->position; - int result; - while ((result= execute(node->children[0], in)) == -1){ - pos= in->position;; + case OR: { + if (execute(node->children[0], in)) { + return 1; } - if (result == 0) { - setPosition(in, pos); + return execute(node->children[1], in); } - return endExploration(in); + case STAR: { + while (execute(node->children[0], in)); + return 1; } case PLUS: { - Node *newNode= mkAnd(node->children[0], mkStar(node->children[0])); - return execute(newNode,in); + if (!execute(node->children[0], in)) { + return 0; + } + while (execute(node->children[0], in)); + return 1; + } + case CLASS: { + if (!currentChar(in)) { + return 0; + } + if (strchr(node->stringValue, currentChar(in))) { + advance(in, 1); + return 1; + } + return 0; + } + case QUESTION_MARK: { + execute(node->children[0], in); + return 1; + } + case EXCLAMATION_MARK: { + int pos= getPosition(in); + if (!execute(node->children[0], in)) { + return 1; + } + setPosition(in, pos); + return 0; + } + case DOT: { + if (atEnd(in)) { + return 0; + } + advance(in, 1); + return 1; } } printf("this cannot happen\n"); @@ -163,32 +236,24 @@ int main(int argc, char **argv) mkAnd(mkString("bb"), mkString("cc")));*/ - Node *program= - mkAnd(mkPlus(mkString("a")), // "a"*"b"*"c"* + /*Node *program= + mkOr(mkPlus(mkString("a")), // "a"*"b"*"c"* mkAnd(mkStar(mkString("b")), - mkStar(mkString("c")))); + mkStar(mkString("c"))));*/ + + Node *program= mkStar(mkClass("abc")); - if (execute(program, in)<=0) + + if (!execute(program, in) || !atEnd(in)) { - printf("no match\n"); + printf("no match, current position : %i\n", getPosition(in)); } else { - printf("match\n"); + printf("match, current position : %i\n", getPosition(in)); }// 0 => no match, 1 => match - - /*Input *in1= mkInput("hello"); - Input *in2= mkInput("world"); - Input *in3= mkInput("hello world"); - Node *program= - mkOr(mkString("hello"), // "hello" | "world" - mkString("world")); - printf("%i\n", execute(program, in)); // 0 => no match, 1 => match*/ - - - return 0; } From d089fe2ea8c6387596069b130318dcc291324ce7 Mon Sep 17 00:00:00 2001 From: lquint <83752971+lquint@users.noreply.github.com> Date: Thu, 24 Jun 2021 09:42:19 +0200 Subject: [PATCH 3/5] Add files via upload ? expression --- lexer.c | 205 +++++++++++++++++++++++--------------------------------- 1 file changed, 82 insertions(+), 123 deletions(-) diff --git a/lexer.c b/lexer.c index d96b605..e566f68 100644 --- a/lexer.c +++ b/lexer.c @@ -9,13 +9,9 @@ typedef struct Exploration Exploration; enum opcode { STRING, AND, - OR, STAR, PLUS, - CLASS, - QUESTION_MARK, - EXCLAMATION_MARK, - DOT + QMARK }; struct Exploration { @@ -31,34 +27,27 @@ Exploration *mkExploration(char *text) return exploration; } -void advance(Exploration *exploration, int add) +char advance(Exploration *exploration) { - exploration->position+= add; + return exploration->text[exploration->position++]; } -int atEnd(Exploration *exploration) { - return exploration->text[exploration->position] == 0; +int endExploration(Exploration *exploration) +{ + if (exploration->position >= strlen(exploration->text)) + { + return 1; + } else + { + return 0; } +} void setPosition(Exploration *exploration, int position) { exploration->position= position; } -int getPosition(Exploration *exploration) { - return exploration->position; -} - -int currentChar(Exploration *exploration) -{ - return exploration->text[exploration->position]; -} - -char *currentText(Exploration *exploration) -{ - return exploration->text + exploration->position; -} - struct Node { @@ -108,113 +97,67 @@ Node *mkPlus(Node *child) return node; } -Node *mkOr(Node *node1, Node *node2) -{ - Node *node= mkNode(OR); - node->children[0]= node1; - node->children[1]= node2; - return node; -} - -Node *mkClass(char* str) -{ - Node *node= mkNode(CLASS); - node->stringValue= str; - return node; -} - -Node *mkQuestionMark(Node *child) -{ - Node *node= mkNode(QUESTION_MARK); - node->children[0]= child; - return node; -} - -Node *mkExclamationMark(Node *child) +Node *mkQmark(Node *child) { - Node *node= mkNode(EXCLAMATION_MARK); + Node *node= mkNode(QMARK); node->children[0]= child; return node; } -Node *mkDot() -{ - Node *node= mkNode(DOT); - return node; -} - - - - int execute(Node *node, Exploration *in) { switch (node->type) { case STRING: { - int length= strlen(node->stringValue); - if (strncmp(currentText(in), node->stringValue, length)) { - return 0; + for (int i=0; i < strlen(node->stringValue);i++) + { + if (advance(in) != node->stringValue[i]) + { + return 0; + } + } + if (endExploration(in)==1) + { + return 1; + } else + { + return -1; } - advance(in, length); - return 1; } case AND: { - int pos= getPosition(in); - if (!execute(node->children[0], in)) //si il y a eu une erreur + if (execute(node->children[0], in) == 0) //si il y a eu une erreur { return 0; - } //si ça s'est bien passé - if (!execute(node->children[1], in)) { - setPosition(in, pos); - return 0; - } - return 1; - } - case OR: { - if (execute(node->children[0], in)) { - return 1; + } else //si ça s'est bien passé + { + return execute(node->children[1], in); } - return execute(node->children[1], in); } case STAR: { - while (execute(node->children[0], in)); - return 1; + if(execute(node->children[0], in) == 1){ + execute(node->children[0], in); + } + else return 1; } case PLUS: { - if (!execute(node->children[0], in)) { - return 0; - } - while (execute(node->children[0], in)); - return 1; - } - case CLASS: { - if (!currentChar(in)) { - return 0; - } - if (strchr(node->stringValue, currentChar(in))) { - advance(in, 1); - return 1; - } - return 0; - } - case QUESTION_MARK: { - execute(node->children[0], in); - return 1; - } - case EXCLAMATION_MARK: { - int pos= getPosition(in); - if (!execute(node->children[0], in)) { - return 1; - } - setPosition(in, pos); - return 0; - } - case DOT: { - if (atEnd(in)) { - return 0; - } - advance(in, 1); - return 1; - } + if(execute(node->children[0],in)==0){ + return 0; + } + else{ + while(execute(node->children[0], in) == 1){ + + execute(node->children[0], in); + + } + return 1; + + } + + } + case QMARK: { + // 0 ou 1 + if(execute(node->children[0], in)==1) return execute(node->children[0], in); + return 1; + } } printf("this cannot happen\n"); abort(); @@ -223,10 +166,11 @@ int execute(Node *node, Exploration *in) int main(int argc, char **argv) { - Exploration *in= mkExploration("aabbcc"); + Exploration *in= mkExploration("acc"); /*Node *program= mkString("aabbcc"); + Node *program= mkAnd(mkString("aab"), mkString("bcc"));*/ @@ -236,24 +180,39 @@ int main(int argc, char **argv) mkAnd(mkString("bb"), mkString("cc")));*/ - /*Node *program= - mkOr(mkPlus(mkString("a")), // "a"*"b"*"c"* + /* Node *program= + mkAnd( mkString("aabbcc"), + mkAnd(mkStar(mkString("c")), // "a"*"b"*"c"* mkAnd(mkStar(mkString("b")), - mkStar(mkString("c"))));*/ - - - Node *program= mkStar(mkClass("abc")); - - - if (!execute(program, in) || !atEnd(in)) + mkStar(mkString("c"))))); +*/ + Node *program= + mkAnd(mkQmark(mkString("a")), // "a"*"b"*"c"* + mkAnd(mkQmark(mkString("b")), + mkPlus(mkString("c")))); + + if (execute(program, in)<=0) { - printf("no match, current position : %i\n", getPosition(in)); + printf("no match\n"); } else { - printf("match, current position : %i\n", getPosition(in)); + printf("match\n"); }// 0 => no match, 1 => match + + /*Input *in1= mkInput("hello"); + Input *in2= mkInput("world"); + Input *in3= mkInput("hello world"); + + Node *program= + mkOr(mkString("hello"), // "hello" | "world" + mkString("world")); + + printf("%i\n", execute(program, in)); // 0 => no match, 1 => match*/ + + + return 0; } From 5eec73387394e46240289b567f62efaf548a493a Mon Sep 17 00:00:00 2001 From: Vank143 <78201359+Vank143@users.noreply.github.com> Date: Thu, 24 Jun 2021 11:45:47 +0200 Subject: [PATCH 4/5] Update lexer.c --- lexer.c | 205 +++++++++++++++++++++++++++++++++----------------------- 1 file changed, 123 insertions(+), 82 deletions(-) diff --git a/lexer.c b/lexer.c index e566f68..d96b605 100644 --- a/lexer.c +++ b/lexer.c @@ -9,9 +9,13 @@ typedef struct Exploration Exploration; enum opcode { STRING, AND, + OR, STAR, PLUS, - QMARK + CLASS, + QUESTION_MARK, + EXCLAMATION_MARK, + DOT }; struct Exploration { @@ -27,27 +31,34 @@ Exploration *mkExploration(char *text) return exploration; } -char advance(Exploration *exploration) +void advance(Exploration *exploration, int add) { - return exploration->text[exploration->position++]; + exploration->position+= add; } -int endExploration(Exploration *exploration) -{ - if (exploration->position >= strlen(exploration->text)) - { - return 1; - } else - { - return 0; +int atEnd(Exploration *exploration) { + return exploration->text[exploration->position] == 0; } -} void setPosition(Exploration *exploration, int position) { exploration->position= position; } +int getPosition(Exploration *exploration) { + return exploration->position; +} + +int currentChar(Exploration *exploration) +{ + return exploration->text[exploration->position]; +} + +char *currentText(Exploration *exploration) +{ + return exploration->text + exploration->position; +} + struct Node { @@ -97,67 +108,113 @@ Node *mkPlus(Node *child) return node; } -Node *mkQmark(Node *child) +Node *mkOr(Node *node1, Node *node2) +{ + Node *node= mkNode(OR); + node->children[0]= node1; + node->children[1]= node2; + return node; +} + +Node *mkClass(char* str) +{ + Node *node= mkNode(CLASS); + node->stringValue= str; + return node; +} + +Node *mkQuestionMark(Node *child) +{ + Node *node= mkNode(QUESTION_MARK); + node->children[0]= child; + return node; +} + +Node *mkExclamationMark(Node *child) { - Node *node= mkNode(QMARK); + Node *node= mkNode(EXCLAMATION_MARK); node->children[0]= child; return node; } +Node *mkDot() +{ + Node *node= mkNode(DOT); + return node; +} + + + + int execute(Node *node, Exploration *in) { switch (node->type) { case STRING: { - for (int i=0; i < strlen(node->stringValue);i++) - { - if (advance(in) != node->stringValue[i]) - { - return 0; - } - } - if (endExploration(in)==1) - { - return 1; - } else - { - return -1; + int length= strlen(node->stringValue); + if (strncmp(currentText(in), node->stringValue, length)) { + return 0; } + advance(in, length); + return 1; } case AND: { - if (execute(node->children[0], in) == 0) //si il y a eu une erreur + int pos= getPosition(in); + if (!execute(node->children[0], in)) //si il y a eu une erreur { return 0; - } else //si ça s'est bien passé - { - return execute(node->children[1], in); + } //si ça s'est bien passé + if (!execute(node->children[1], in)) { + setPosition(in, pos); + return 0; + } + return 1; + } + case OR: { + if (execute(node->children[0], in)) { + return 1; } + return execute(node->children[1], in); } case STAR: { - if(execute(node->children[0], in) == 1){ - execute(node->children[0], in); - } - else return 1; + while (execute(node->children[0], in)); + return 1; } case PLUS: { - if(execute(node->children[0],in)==0){ - return 0; - } - else{ - while(execute(node->children[0], in) == 1){ - - execute(node->children[0], in); - - } - return 1; - - } - - } - case QMARK: { - // 0 ou 1 - if(execute(node->children[0], in)==1) return execute(node->children[0], in); - return 1; - } + if (!execute(node->children[0], in)) { + return 0; + } + while (execute(node->children[0], in)); + return 1; + } + case CLASS: { + if (!currentChar(in)) { + return 0; + } + if (strchr(node->stringValue, currentChar(in))) { + advance(in, 1); + return 1; + } + return 0; + } + case QUESTION_MARK: { + execute(node->children[0], in); + return 1; + } + case EXCLAMATION_MARK: { + int pos= getPosition(in); + if (!execute(node->children[0], in)) { + return 1; + } + setPosition(in, pos); + return 0; + } + case DOT: { + if (atEnd(in)) { + return 0; + } + advance(in, 1); + return 1; + } } printf("this cannot happen\n"); abort(); @@ -166,11 +223,10 @@ int execute(Node *node, Exploration *in) int main(int argc, char **argv) { - Exploration *in= mkExploration("acc"); + Exploration *in= mkExploration("aabbcc"); /*Node *program= mkString("aabbcc"); - Node *program= mkAnd(mkString("aab"), mkString("bcc"));*/ @@ -180,37 +236,22 @@ int main(int argc, char **argv) mkAnd(mkString("bb"), mkString("cc")));*/ - /* Node *program= - mkAnd( mkString("aabbcc"), - mkAnd(mkStar(mkString("c")), // "a"*"b"*"c"* + /*Node *program= + mkOr(mkPlus(mkString("a")), // "a"*"b"*"c"* mkAnd(mkStar(mkString("b")), - mkStar(mkString("c"))))); -*/ - Node *program= - mkAnd(mkQmark(mkString("a")), // "a"*"b"*"c"* - mkAnd(mkQmark(mkString("b")), - mkPlus(mkString("c")))); - - if (execute(program, in)<=0) - { - printf("no match\n"); - } else - { - printf("match\n"); - }// 0 => no match, 1 => match - + mkStar(mkString("c"))));*/ + Node *program= mkStar(mkClass("abc")); - /*Input *in1= mkInput("hello"); - Input *in2= mkInput("world"); - Input *in3= mkInput("hello world"); - - Node *program= - mkOr(mkString("hello"), // "hello" | "world" - mkString("world")); - printf("%i\n", execute(program, in)); // 0 => no match, 1 => match*/ + if (!execute(program, in) || !atEnd(in)) + { + printf("no match, current position : %i\n", getPosition(in)); + } else + { + printf("match, current position : %i\n", getPosition(in)); + }// 0 => no match, 1 => match From c0cb24584cb692cf472ced68d40700ba949cdeee Mon Sep 17 00:00:00 2001 From: lquint <83752971+lquint@users.noreply.github.com> Date: Mon, 28 Jun 2021 15:24:15 +0200 Subject: [PATCH 5/5] Add files via upload --- lexer.c | 81 ++++++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 71 insertions(+), 10 deletions(-) diff --git a/lexer.c b/lexer.c index d96b605..74f1dd1 100644 --- a/lexer.c +++ b/lexer.c @@ -59,12 +59,15 @@ char *currentText(Exploration *exploration) return exploration->text + exploration->position; } +struct String { enum opcode type; char *stringValue; int len;}; +struct Class { enum opcode type; char *stringValue; int len;}; struct Node { enum opcode type; union { - char *stringValue; + struct String STRING; + struct Class CLASS; Node *children[2]; }; }; @@ -81,7 +84,8 @@ Node *mkNode(enum opcode type) Node *mkString(char *value) { Node *node= mkNode(STRING); - node->stringValue= value; + node->STRING.stringValue= value; + node->STRING.len=strlen(value); return node; } @@ -119,7 +123,8 @@ Node *mkOr(Node *node1, Node *node2) Node *mkClass(char* str) { Node *node= mkNode(CLASS); - node->stringValue= str; + node->STRING.stringValue= str; + node->STRING.len=strlen(str); return node; } @@ -143,6 +148,63 @@ Node *mkDot() return node; } +Node *_checktype(Node *object, enum opcode type) +{ + if (object->type == type) return object; + fprintf(stderr, "\naccesing type %i as if it were a %i\n", object->type, type); + exit(1); + return 0; +} + +#define get(object, type, member) (_checktype(object, type)->type.member) + +const char* getTypeName(enum opcode type) +{ + switch (type) + { + case STAR: return "STAR"; + case EXCLAMATION_MARK: return "NOT"; + case DOT: return "DOT"; + case QUESTION_MARK: return "QMARK"; + case PLUS : return "PLUS"; + case CLASS : return "CLASS"; + default : printf("unexpected use");return 0; + abort(); + } +} + +void println(Node *node, int indent) +{ + for(int i=0;itype) { + case STRING: printf("%.*s", get(node, STRING, len), get(node, STRING, stringValue)); return; + case AND: { + printf("AND\n"); + println(node->children[0],indent);printf("\n"); + println(node->children[1],indent);printf("\n");return; + } + case OR: { + printf("OR\n"); + println(node->children[0],indent);printf("\n"); + println(node->children[1],indent);printf("\n");return; + } + case DOT:{ + printf("DOT\n");return; + } + case CLASS:{ + printf("CLASS : Char in [%.*s]\n",get(node, CLASS, len),get(node, CLASS, stringValue));return; + } + default : { + printf("%s\n",getTypeName(node->type)); + println(node->children[0],indent);printf("\n");return; + } + } + abort(); +} @@ -150,11 +212,10 @@ int execute(Node *node, Exploration *in) { switch (node->type) { case STRING: { - int length= strlen(node->stringValue); - if (strncmp(currentText(in), node->stringValue, length)) { + if (strncmp(currentText(in), node->STRING.stringValue, node->STRING.len)) { return 0; } - advance(in, length); + advance(in, node->STRING.len); return 1; } case AND: { @@ -190,7 +251,7 @@ int execute(Node *node, Exploration *in) if (!currentChar(in)) { return 0; } - if (strchr(node->stringValue, currentChar(in))) { + if (strchr(node->STRING.stringValue, currentChar(in))) { advance(in, 1); return 1; } @@ -243,7 +304,7 @@ int main(int argc, char **argv) Node *program= mkStar(mkClass("abc")); - + Node *program3=mkAnd(mkAnd(mkPlus(mkString("hello world")),mkExclamationMark(mkString("how are u world !?"))),mkStar(mkClass("abcde"))); if (!execute(program, in) || !atEnd(in)) { @@ -252,8 +313,8 @@ int main(int argc, char **argv) { printf("match, current position : %i\n", getPosition(in)); }// 0 => no match, 1 => match - + println(program3,0); return 0; -} +} \ No newline at end of file