Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!dalcs!aucs!820785gm From: 820785gm@aucs.UUCP Newsgroups: comp.lang.c Subject: whats wrong with this lex grammer? (help) Message-ID: <443@aucs.UUCP> Date: Mon, 21-Sep-87 14:47:25 EDT Article-I.D.: aucs.443 Posted: Mon Sep 21 14:47:25 1987 Date-Received: Tue, 22-Sep-87 01:10:17 EDT Distribution: na Organization: School of Computer Science, Acadia Univ., Nova Scotia Lines: 40 Keywords: Didn't know where to post it Well, I wasn't sure where to post this, but I'm sure someone on this group will know the answer. My question refers to the regular grammer of lex. For recognizing comments (ie (*...*) ) I have this horrible long statement that works. However, I have a much nicer one that I don't uunderstand why it doesn't work.(Nobody here can seem to tell me why either). Here is the short lex program: %% "(*"([^*]|("*"/[^)]))*"*)" printf("&%s&\n", yytext); but it doesn't work. Would somebody mind explaining why ? The part that really confuses me is shown in this run : (*andrew*) macleod (*was*) here &(*andrew*& ) macleod &(*was*& ) here (**)kk &(**& it recognizes the grammer here, but it doesn't )kk accept the last ')'. (****) Anyway, can anybody help me. I'm sure it must be simple. &(****& ) (***) *) Oh yeah, its under 4.3BSD. &(***) *& ) Thanks a lot, ANDROID.