<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>Hi,</p>
    <p>in <br>
    </p>
    <p><a class="moz-txt-link-freetext" href="http://erlang.org/doc/programming_examples/bit_syntax.html#constructing-binaries-and-bitstrings">http://erlang.org/doc/programming_examples/bit_syntax.html#constructing-binaries-and-bitstrings</a></p>
    <p>I found:<br>
    </p>
    <p><quote></p>
    <p>As mentioned earlier, segments have the following general syntax:</p>
    <p><span class="code">Value:Size/TypeSpecifierList</span></p>
    <p>When constructing binaries, <span class="code">Value</span> and
      <span class="code">Size</span> can be any Erlang expression.
      However, for syntactical reasons, both <span class="code">Value</span>
      and <span class="code">Size</span> must be enclosed in
      parenthesis if the expression consists of anything more than a
      single literal or a variable. The following gives a compiler
      syntax error:</p>
    <div class="example hljs">
      <pre><<X+1:8>></pre>
    </div>
    <p>This expression must be rewritten into the following, to be
      accepted by the compiler:</p>
    <div class="example hljs">
      <pre><<(X+1):8>>
</quote>

Seems to me that this condition makes live for the parser a bit easier.

kind regards,
Dieter

</pre>
    </div>
    <div class="moz-cite-prefix">On 18.01.19 15:25, Jeroen Koops wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAHk3MH_VDmK4up1F7Nodmu=tYCi+NNPzR=ZJSxD6qE0_uchEVA@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">
        <div dir="ltr">
          <div dir="ltr">Thanks Jachym and Brujo,
            <div><br>
            </div>
            <div>I did try </div>
            <div><br>
            </div>
            <div><< (case foo of foo -> 1; bar -> 2 end) bor
              (case foo of foo -> 8; bar -> 16 end) >>.<br>
            </div>
            <div><br>
            </div>
            <div>which didn't work, but</div>
            <div><br>
            </div>
            <div><< (case foo of foo -> 1; bar -> 2 end bor
              case foo of foo -> 8; bar -> 16 end) >>.<br>
            </div>
            <div><br>
            </div>
            <div>indeed does work.</div>
            <div><br>
            </div>
            <div><br>
            </div>
          </div>
        </div>
      </div>
      <br>
      <div class="gmail_quote">
        <div dir="ltr" class="gmail_attr">On Fri, Jan 18, 2019 at 3:19
          PM Jáchym Holeček <<a href="mailto:freza@circlewave.net"
            moz-do-not-send="true">freza@circlewave.net</a>> wrote:<br>
        </div>
        <blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
          <div>
            <div>Hi Joeren,<br>
            </div>
            <div><br>
            </div>
            <div>My guess: allowing entirely arbitrary expression within
              binary constructor<br>
            </div>
            <div>syntax could lead to ambiguities with respect to `/`
              and `-` and `:` tokens<br>
            </div>
            <div>which have special meaning in this context? Therefore
              only select expression<br>
            </div>
            <div>forms are permitted, which are free of ambiguities, one
              of them being `( E )`<br>
            </div>
            <div>which in turn opens access to arbitrary expressions if
              one is a bit more explicit.<br>
            </div>
            <div><br>
            </div>
            <div>So this will work:<br>
            </div>
            <div><br>
            </div>
            <div>    4> << (case foo of foo -> 1; bar ->
              2 end bor case foo of foo -> 8; bar -> 16 end)
              >>.<br>
            </div>
            <div>    <<"\t">><br>
            </div>
            <div><br>
            </div>
            <div>The file `stdlib-3.4.4/src/erl_parse.yrl` has the
              mechanics of it (search for `binary`,<br>
            </div>
            <div>`bin_elements`, `bin_element`) though not the
              underlying reasoning.<br>
            </div>
            <div><br>
            </div>
            <div>HTH,<br>
            </div>
            <div>    -- Jachym</div>
            <div><br>
            </div>
            <div>On Fri, Jan 18, 2019, at 15:04, Jeroen Koops wrote:<br>
            </div>
            <blockquote type="cite">
              <div dir="ltr">
                <div dir="ltr">
                  <div dir="ltr">
                    <div dir="ltr">
                      <div>Hi List!<br>
                      </div>
                      <div><br>
                      </div>
                      <div>If this expressions is legal:<br>
                      </div>
                      <div><br>
                      </div>
                      <div>
                        <p
                          style="margin:0px;font-stretch:normal;line-height:normal"><span
                            class="gmail-m_-8098032284801275923font"
                            style="font-family:Menlo"><span
                              class="gmail-m_-8098032284801275923size"
                              style="font-size:11px"><span
                                style="font-variant-ligatures:no-common-ligatures">case
                                A of foo -> 1; bar -> 2 end bor
                                case A of foo -> 8; bar -> 16 end.</span></span></span><br>
                        </p>
                        <p
                          style="margin:0px;font-stretch:normal;line-height:normal"><span
                            class="gmail-m_-8098032284801275923font"
                            style="font-family:Menlo"><span
                              class="gmail-m_-8098032284801275923size"
                              style="font-size:11px"><span
                                style="font-variant-ligatures:no-common-ligatures"></span></span></span><br>
                        </p>
                        <p
                          style="margin:0px;font-stretch:normal;line-height:normal"><span
style="font-variant-ligatures:no-common-ligatures"><span
                              class="gmail-m_-8098032284801275923font"
                              style="font-family:arial,"
                              helvetica"," sans-serif"">...
                              and this expression is legal:</span></span><br>
                        </p>
                        <p
                          style="margin:0px;font-stretch:normal;line-height:normal"><span
                            class="gmail-m_-8098032284801275923font"
                            style="font-family:Menlo"><span
                              class="gmail-m_-8098032284801275923size"
                              style="font-size:11px"><span
                                style="font-variant-ligatures:no-common-ligatures"></span></span></span><br>
                        </p>
                        <p
                          style="margin:0px;font-stretch:normal;line-height:normal"><span
                            class="gmail-m_-8098032284801275923font"
                            style="font-family:Menlo"><span
                              class="gmail-m_-8098032284801275923size"
                              style="font-size:11px"><span
                                style="font-variant-ligatures:no-common-ligatures"></span></span></span><br>
                        </p>
                        <p
                          style="margin:0px;font-stretch:normal;line-height:normal"><span
                            class="gmail-m_-8098032284801275923font"
                            style="font-family:Menlo"><span
                              class="gmail-m_-8098032284801275923size"
                              style="font-size:11px"><span
                                style="font-variant-ligatures:no-common-ligatures"><<
                                case A of foo -> 1; bar -> 2 end
                                >>. </span></span></span><br>
                        </p>
                        <p
                          style="margin:0px;font-stretch:normal;line-height:normal"><span
                            class="gmail-m_-8098032284801275923font"
                            style="font-family:Menlo"><span
                              class="gmail-m_-8098032284801275923size"
                              style="font-size:11px"><span
                                style="font-variant-ligatures:no-common-ligatures"></span></span></span><br>
                        </p>
                        <p
                          style="margin:0px;font-stretch:normal;line-height:normal"><span
style="font-variant-ligatures:no-common-ligatures"><span
                              class="gmail-m_-8098032284801275923font"
                              style="font-family:arial,"
                              helvetica"," sans-serif"">...
                              then why is this expression illegal:</span></span><br>
                        </p>
                        <p
                          style="margin:0px;font-stretch:normal;line-height:normal"><span
                            class="gmail-m_-8098032284801275923font"
                            style="font-family:Menlo"><span
                              class="gmail-m_-8098032284801275923size"
                              style="font-size:11px"><span
                                style="font-variant-ligatures:no-common-ligatures"></span></span></span><br>
                        </p>
                        <p
                          style="margin:0px;font-stretch:normal;line-height:normal"><span
                            class="gmail-m_-8098032284801275923font"
                            style="font-family:Menlo"><span
                              class="gmail-m_-8098032284801275923size"
                              style="font-size:11px"><span
                                style="font-variant-ligatures:no-common-ligatures"></span></span></span><br>
                        </p>
                        <p
                          style="margin:0px;font-stretch:normal;line-height:normal"><span
                            class="gmail-m_-8098032284801275923font"
                            style="font-family:Menlo"><span
                              class="gmail-m_-8098032284801275923size"
                              style="font-size:11px"><span
                                style="font-variant-ligatures:no-common-ligatures"><<
                                case A of foo -> 1; bar -> 2 end
                                bor case A of foo -> 8; bar -> 16
                                end >>.</span></span></span><br>
                        </p>
                        <p
                          style="margin:0px;font-stretch:normal;line-height:normal"><span
                            class="gmail-m_-8098032284801275923font"
                            style="font-family:Menlo"><span
                              class="gmail-m_-8098032284801275923size"
                              style="font-size:11px"><span
                                style="font-variant-ligatures:no-common-ligatures"></span></span></span><br>
                        </p>
                        <p
                          style="margin:0px;font-stretch:normal;line-height:normal"><span
style="font-variant-ligatures:no-common-ligatures"><span
                              class="gmail-m_-8098032284801275923font"
                              style="font-family:arial,"
                              helvetica"," sans-serif"">(shell
                              responds with "</span><span
                              class="gmail-m_-8098032284801275923font"
                              style="font-family:monospace,"
                              monospace"">* 1: syntax error before:
                              'bor'</span><span
                              class="gmail-m_-8098032284801275923font"
                              style="font-family:arial,"
                              helvetica"," sans-serif"">")</span></span><br>
                        </p>
                        <p
                          style="margin:0px;font-stretch:normal;line-height:normal"><span
style="font-variant-ligatures:no-common-ligatures"><span
                              class="gmail-m_-8098032284801275923font"
                              style="font-family:arial,"
                              helvetica"," sans-serif""></span></span><br>
                        </p>
                        <p
                          style="margin:0px;font-stretch:normal;line-height:normal"><span
style="font-variant-ligatures:no-common-ligatures"><span
                              class="gmail-m_-8098032284801275923font"
                              style="font-family:arial,"
                              helvetica"," sans-serif"">Thanks,</span></span><br>
                        </p>
                        <div><br>
                        </div>
                        <div>-- <br>
                        </div>
                        <div dir="ltr">
                          <div>Jeroen Koops<br>
                          </div>
                          <div><br>
                          </div>
                          <div>M: <a href="mailto:koops.j@gmail.com"
                              target="_blank" moz-do-not-send="true">koops.j@gmail.com</a><br>
                          </div>
                          <div>T: +31-6-55590300<br>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
              <div><u>_______________________________________________</u><br>
              </div>
              <div>erlang-questions mailing list<br>
              </div>
              <div><a href="mailto:erlang-questions@erlang.org"
                  target="_blank" moz-do-not-send="true">erlang-questions@erlang.org</a><br>
              </div>
              <div><a
                  href="http://erlang.org/mailman/listinfo/erlang-questions"
                  target="_blank" moz-do-not-send="true">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
              </div>
            </blockquote>
            <div><br>
            </div>
          </div>
          _______________________________________________<br>
          erlang-questions mailing list<br>
          <a href="mailto:erlang-questions@erlang.org" target="_blank"
            moz-do-not-send="true">erlang-questions@erlang.org</a><br>
          <a href="http://erlang.org/mailman/listinfo/erlang-questions"
            rel="noreferrer" target="_blank" moz-do-not-send="true">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
        </blockquote>
      </div>
      <br clear="all">
      <div><br>
      </div>
      -- <br>
      <div dir="ltr" class="gmail_signature">
        <div>Jeroen Koops</div>
        <div><br>
        </div>
        <div>M: <a href="mailto:koops.j@gmail.com" target="_blank"
            moz-do-not-send="true">koops.j@gmail.com</a></div>
        <div>T: +31-6-55590300</div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
erlang-questions mailing list
<a class="moz-txt-link-abbreviated" href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a>
<a class="moz-txt-link-freetext" href="http://erlang.org/mailman/listinfo/erlang-questions">http://erlang.org/mailman/listinfo/erlang-questions</a>
</pre>
    </blockquote>
  </body>
</html>