From 205405f0bf1d2fa37d4c8170c11689a2937f5d9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Tue, 1 Mar 2016 06:23:36 +0100 Subject: Generalize bit string comprehensions The expression in a bit string comprehension is limited to a literal bit string expression. That is, the following code is legal: << <> || X <- List >> but not this code: << foo(X) || X <- List >> The limitation is annoying. For one thing, tools that transform the abstract format must be careful not to produce code such as: << begin %% Some instrumentation code. <> end || X <- List >> One reason for the limitation could be that we'll get reduce/reduce conflicts if we try to allow an arbitrary expression in a bit string comprehension: binary_comprehension -> '<<' expr '||' lc_exprs '>>' : {bc,?anno('$1'),'$2','$4'}. Unfortunately, there does not seem to be an easy way to work around that problem. The best we can do is to allow 'expr_max' expressions (as in the binary syntax): binary_comprehension -> '<<' expr_max '||' lc_exprs '>>' : {bc,?anno('$1'),'$2','$4'}. That will work, but functions calls must be enclosed in parentheses: << (foo(X)) || X <- List >> --- system/doc/reference_manual/expressions.xml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'system') diff --git a/system/doc/reference_manual/expressions.xml b/system/doc/reference_manual/expressions.xml index e98fcbcbb9..75486488e9 100644 --- a/system/doc/reference_manual/expressions.xml +++ b/system/doc/reference_manual/expressions.xml @@ -1556,9 +1556,11 @@ end

Bit string comprehensions are written with the following syntax:

-<< BitString || Qualifier1,...,QualifierN >>
-

Here, BitString is a bit string expression and each - Qualifier is either a generator, a bit string generator or a filter.

+<< BitStringExpr || Qualifier1,...,QualifierN >> +

BitStringExpr is an expression that evalutes to a bit + string. If BitStringExpr is a function call, it must be + enclosed in parentheses. Each Qualifier is either a + generator, a bit string generator or a filter.

A generator is written as:

  .

-- cgit v1.2.3