A: G[S]: S->aSb|a
B: G[S]: S->Sa|a
C: G[S]: S->aS|a
D: G[S]: S->Ab|a A->Bb|c B->Sc|d
举一反三
- 下列描述括号匹配的文法中,属于LL(1)文法的有______。(1)S->(SS’|ε S’->)|ε (2)S->(S)S|ε(3)S->S(S)S|ε(4)S->(S|S’ S’->(S’)|ε A: (1) B: (2) C: (3) D: (4)
- 中国大学MOOC: 下列描述括号匹配的文法中,属于LL(1)文法的有______。(1)S->(SS’|ε S’->)|ε (2)S->(S)S|ε(3)S->S(S)S|ε(4)S->(S|S’ S’->(S’)|ε
- 设有文法G[S]=({S,B},{b},{S->b|bB,B->bS},S),该文法所描述的语言是() A: L(G[S]={b i|i>=0}) B: L(G[S]={b2 i|i>=0}) C: L(G[S]={b 2i+1|i>=0}) D: L(G[S]={b2 i|i>=1})
- 对于文法G[S]: S->A S | b A->S A | a 。下面属于LR(0)项目的是________。 A: S′→S B: S→AS|b C: A→SA|a D: S’->·S
- 下列文法中,生成的语言是[img=219x36]18035825c53a6ba.png[/img]的是 A: G(S): S → ABCD A → aA | a B → bB | b C → cC | c D → dD | d B: G(S): S → AC A → aAb | ab C → cCd | cd C: G(S): S → aSd | A A → bAc | bc D: G(S): S → aSb | A A → cAd | cd
内容
- 0
下列文法中,生成的语言是[img=219x36]1803958e27bf0a1.png[/img]的是 A: G(S): S → ABCD A → aA | a B → bB | b C → cC | c D → dD | d B: G(S): S → AC A → aAb | ab C → cCd | cd C: G(S): S → aSd | A A → bAc | bc D: G(S): S → aSb | A A → cAd | cd
- 1
下列文法中,生成的语言是[img=219x36]18036d67930bcbe.png[/img]的是 A: G(S): S → ABCD A → aA | a B → bB | b C → cC | c D → dD | d B: G(S): S → AC A → aAb | ab C → cCd | cd C: G(S): S → aSd | A A → bAc | bc D: G(S): S → aSb | A A → cAd | cd
- 2
二叉排序树采用二叉链表存储,结点结构为:lchild|data|rchild,指针lchild和rchild分别指向结点的左右孩子结点。令T指向根结点,则求T的左子树上最大的结点算法的核心语句是( )。 A: if (T) { s=T->lchild;if (s) { while(s->rchild) s=s->rchild; }}return s; B: if (T) { s=T->rchild;if (s) { while(s->rchild) s=s->rchild; }}return s; C: if (T) { s=T->rchild;if (s) { while(s->lchild) s=s->lchild; }}return s; D: if (T) { s=T->lchild;if (s) { while(s->lchild) s=s->lchild; }}return s;
- 3
在循环双链表的P所指节点之后插入s所指节点的操作是( ) A: p->next=s; s->prior=p; p->next->prior=s; s->next=p->next; B: p->next=s; p->next->prior=s; s->prior=p; s->next=p->next; C: s->prior=p; s->next=p->next; p->next=s; p->next->prior=s; D: s->prior=p; s->next=p->next; p->next=s;p->next->prior=s;
- 4
在循环双链表的p所指结点之后插入s结点的操作是( ) A: p->next=s; s->pre=p; p->next->pre=s; s->next=p->next; B: p->next=s; p->next->pre=s; s->pre=p; s->next=p->next; C: s->pre=p; s->next=p->next; p->next->pre=s; p->next=s; D: s->pre=p; s->next=p->next; p->next=s; p->next->pre=s;