doc: add EBNF and describe more about memory buffers