当前位置: 动力学知识库 > 问答 > 编程问答 >

regex - formalizing the following format in Context Free Grammar / BNF?

问题描述:

i have a file format that looks like the following:

fileformat : <flag1><flag2><flag3><flag4><field1><field2><field3><field4>

each flag is 1 bit, and each field is 1 byte.

when the flag is '1', the respective field will be present.

when the flag is '0', the respective field will be absent.

is there a way to represent that in EBNF/BNF without enumerating all the 2^4 possibilities?

分享给朋友:
您可能感兴趣的文章:
随机阅读: