# Return to Question

3 Improved title, added tag, and minor change

# BNF Parsingparsing rule questionsfor left associativity

Can someone please assist me with the following question.

Write a BNF rule to parse into

``````C -> E
C -> E && E
C -> E && E && E
``````

so that `C` generates as many `E && E` as needed and enforces left association.

Is the following correct?

``````C -> C && E | E
``````

It should force left association because of the left recursion and make as many && E's`&& E`'s it wants to because of the recursion.

# BNF Parsing rule questions

Can someone please assist me with the following question.

Write a BNF rule to parse into

``````C -> E
C -> E && E
C -> E && E && E
``````

so that `C` generates as many `E && E` as needed and enforces left association.

Is the following correct?

``````C -> C && E | E
``````

It should force left association because of the left recursion and make as many && E's it wants to because of the recursion.

# BNF parsing rule for left associativity

Can someone please assist me with the following question.

Write a BNF rule to parse into

``````C -> E
C -> E && E
C -> E && E && E
``````

so that `C` generates as many `E && E` as needed and enforces left association.

Is the following correct?

``````C -> C && E | E
``````

It should force left association because of the left recursion and make as many `&& E`'s it wants to because of the recursion.

2 corrected code formatting

Can someone please assist me with the following question (btw, if programmer.stackexchange.com isn't the correct place to list my question, please let me know).

Write a BNF rule to parse into C -> E C -> E && E C -> E && E && E

``````C -> E
C -> E && E
C -> E && E && E
``````

so that C`C` generates as many E && E`E && E` as needed and enforces left association.

Is the following correct?

C -> C && E | E

``````C -> C && E | E
``````

It should force left association because of the left recursion and make as many && E's it wants to because of the recursion.

Can someone please assist me with the following question (btw, if programmer.stackexchange.com isn't the correct place to list my question, please let me know).

Write a BNF rule to parse into C -> E C -> E && E C -> E && E && E

so that C generates as many E && E as needed and enforces left association.

Is the following correct?

C -> C && E | E

It should force left association because of the left recursion and make as many && E's it wants to because of the recursion.

Can someone please assist me with the following question.

Write a BNF rule to parse into

``````C -> E
C -> E && E
C -> E && E && E
``````

so that `C` generates as many `E && E` as needed and enforces left association.

Is the following correct?

``````C -> C && E | E
``````

It should force left association because of the left recursion and make as many && E's it wants to because of the recursion.

1

# BNF Parsing rule questions

Can someone please assist me with the following question (btw, if programmer.stackexchange.com isn't the correct place to list my question, please let me know).

Write a BNF rule to parse into C -> E C -> E && E C -> E && E && E

so that C generates as many E && E as needed and enforces left association.

Is the following correct?

C -> C && E | E

It should force left association because of the left recursion and make as many && E's it wants to because of the recursion.