µÚÒ»·¶ÎÄÍø - רҵÎÄÕ·¶ÀýÎĵµ×ÊÁÏ·ÖÏíÆ½Ì¨

±àÒëÔ­Àí-LL(1)ÎÄ·¨Ô´´úÂ루ʵÑéÈý£©

À´Ô´£ºÓû§·ÖÏí ʱ¼ä£º2025/8/5 9:02:30 ±¾ÎÄÓÉloading ·ÖÏí ÏÂÔØÕâÆªÎĵµÊÖ»ú°æ
˵Ã÷£ºÎÄÕÂÄÚÈݽö¹©Ô¤ÀÀ£¬²¿·ÖÄÚÈÝ¿ÉÄܲ»È«£¬ÐèÒªÍêÕûÎĵµ»òÕßÐèÒª¸´ÖÆÄÚÈÝ£¬ÇëÏÂÔØwordºóʹÓá£ÏÂÔØwordÓÐÎÊÌâÇëÌí¼Ó΢ÐźÅ:xxxxxxx»òQQ£ºxxxxxx ´¦Àí£¨¾¡¿ÉÄܸøÄúÌṩÍêÕûÎĵµ£©£¬¸ÐлÄúµÄÖ§³ÖÓëÁ½⡣

if(100 > pt->rCursor) {

AddFirst(U, pt->rCursor); break; } else {

if(NULL == first[pt->rCursor - 100]) {

First(pt->rCursor); }

AddFirst(U, pt->rCursor); if(!HaveEmpty(pt->rCursor)) {

break; } else {

pt = pt->next; } } j++; }

if(j >= P[i].rLength) /*µ±²úÉúʽÓÒ²¿¶¼ÄÜÍÆ³ö¿Õʱ*/ AddFirst(U, -1); } } }

/*¼ÓÈëfirst¼¯*/

void AddFirst(int U, int nCh) {

struct collectNode *pt, *qt; int ch; /*ÓÃÓÚ´¦ÀíVn*/ pt = NULL; qt = NULL; if(nCh < 100) {

pt = first[U - 100]; while(NULL != pt) {

if(pt->nVt == nCh) break;

else {

qt = pt;

pt = pt->next; } }

if(NULL == pt) {

pt = (struct collectNode *)malloc(sizeof(struct collectNode)); pt->nVt = nCh; pt->next = NULL;

if(NULL == first[U - 100]) {

first[U - 100] = pt; } else {

qt->next = pt; /*qtÖ¸Ïòfirst¼¯µÄ×îºóÒ»¸öÔªËØ*/ }

pt = pt->next; } } else {

pt = first[nCh - 100]; while(NULL != pt) {

ch = pt->nVt; if(-1 != ch) {

AddFirst(U, ch); }

pt = pt->next; } } }

bool HaveEmpty(int nVn) {

if(nVn < 100) return false;

struct collectNode *pt; pt = first[nVn - 100]; while(NULL != pt)

{

if(-1 == pt->nVt) return true; pt = pt->next; }

return false; }

void Follow(int V) { int i;

struct pRNode *pt ;

if(100 == V) /*µ±Îª³õʼ·ûʱ*/ AddFollow(V, -1, 0 ); for(i = 0; i < PNum; i++) {

pt = P[i].rHead;

while(NULL != pt && pt->rCursor != V) pt = pt->next; if(NULL != pt) {

pt = pt->next; if(NULL == pt) {

if(NULL == follow[P[i].lCursor - 100] && P[i].lCursor != V) {

Follow(P[i].lCursor); }

AddFollow(V, P[i].lCursor, 0); } else {

while(NULL != pt && HaveEmpty(pt->rCursor)) {

AddFollow(V, pt->rCursor, 1); pt = pt->next; }

if(NULL == pt) {

if(NULL == follow[P[i].lCursor - 100] && P[i].lCursor != V) {

Follow(P[i].lCursor); }

AddFollow(V, P[i].lCursor, 0); } else {

AddFollow(V, pt->rCursor, 1); } } } } }

void AddFollow(int V, int nCh, int kind) {

struct collectNode *pt, *qt; int ch; pt = NULL; qt = NULL;

if(nCh < 100) /*ΪÖÕ½á·ûʱ*/ {

pt = follow[V - 100]; while(NULL != pt) {

if(pt->nVt == nCh) break; else {

qt = pt;

pt = pt->next; } }

if(NULL == pt) {

pt = (struct collectNode *)malloc(sizeof(struct collectNode)); pt->nVt = nCh; pt->next = NULL;

if(NULL == follow[V - 100]) {

follow[V - 100] = pt; } else {

qt->next = pt; /*qtÖ¸Ïòfollow¼¯µÄ×îºóÒ»¸öÔªËØ*/ }

ËÑË÷¸ü¶à¹ØÓÚ£º ±àÒëÔ­Àí-LL(1)ÎÄ·¨Ô´´úÂ루ʵÑéÈý£© µÄÎĵµ
±àÒëÔ­Àí-LL(1)ÎÄ·¨Ô´´úÂ루ʵÑéÈý£©.doc ½«±¾ÎĵÄWordÎĵµÏÂÔØµ½µçÄÔ£¬·½±ã¸´ÖÆ¡¢±à¼­¡¢ÊղغʹòÓ¡
±¾ÎÄÁ´½Ó£ºhttps://www.diyifanwen.net/c7gjb70zk826o2vt5lzj67d82u9zjet00ieo_5.html£¨×ªÔØÇë×¢Ã÷ÎÄÕÂÀ´Ô´£©
ÈÈÃÅÍÆ¼ö
Copyright © 2012-2023 µÚÒ»·¶ÎÄÍø °æÈ¨ËùÓÐ ÃâÔðÉùÃ÷ | ÁªÏµÎÒÃÇ
ÉùÃ÷ :±¾ÍøÕ¾×ðÖØ²¢±£»¤ÖªÊ¶²úȨ£¬¸ù¾Ý¡¶ÐÅÏ¢ÍøÂç´«²¥È¨±£»¤ÌõÀý¡·£¬Èç¹ûÎÒÃÇ×ªÔØµÄ×÷Æ·ÇÖ·¸ÁËÄúµÄȨÀû,ÇëÔÚÒ»¸öÔÂÄÚ֪ͨÎÒÃÇ£¬ÎÒÃǻἰʱɾ³ý¡£
¿Í·þQQ£ºxxxxxx ÓÊÏ䣺xxxxxx@qq.com
ÓåICP±¸2023013149ºÅ
Top