質問

I'm using EBNF to define a grammar.

But I'm stuck because I need to define a permutation : I have a set of values that can be combined, but they have to be used only once and I don't care about the order.

How to do it with EBNF ?

example: values : a, b ,c

possible combinations : abc, acb, bac, bca, cab, cba

役に立ちましたか?

解決

Such a thing cannot be expressed in (E)BNF, other than simply defining every permutation manually:

values = "abc" | "acb" | "bac" | "bca" | "cab" | "cba" ;
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top