PDA

View Full Version : BNF Problems and BNF exercises



mfvpcrec
April 26th, 2015, 09:01 PM
Hello to everyone . I do this post because i have a doubt with a BNF problem. I dont know if i'm thinking well the solution


The problem is this ...




"Write a BNF for this binary tree representation
([Node1]):([LeftChild],[RightChild]))
[(Node1],[Node2]...........[NodeN]):([LeftChild1],[RightChild1]),([LeftChild2],[RightChild2]).............([LeftChildN],[RightChildN]))"




My solution:





Tree->(<T>)
T ->[<Node>],<T>,([<ChildLeft>],[<ChildRight>])
T ->[<Node>]):([<ChildLeft>],[<ChildRight>])

It is ok? I don't know if I'm thinking well the recursivity of this BFN.


Moreover ...Someone knows where are more BNF exercises? This subject is killing me ](*,). I never know if i do well the exercises.


Thanks!