---
# System prepended metadata

title: 簡易計算欄位 - BNF
tags: [計算欄位]

---

---
robots: noindex, nofollow
tags: 計算欄位
---

# 簡易計算欄位 - BNF

```bnf
<expr> ::= <subscript>
        |  <binary>
        |  <func>
        |  <field>
        |  <list-field>
        |  <num>
        |  <str>
        |  <empty>

<empty> ::= <optional-whitespaces>

<str> ::= <parsimmon-string>

<num> ::= <parsimmon-number>

<subscript> ::= <subscript-base> "[" <num> "]"

<subscript-base> ::= "(" <binary> ")"
                  |  <subscriptable>

<subscriptable> ::= <func>
                 |  <field>
                 |  <list-field>
                 |  <str>

<field> ::= "{" <symbol-without-spaces-and-right-brace> "}"

<list-field> ::= "[" <symbol-without-spaces-and-right-bracket> "]"

<paren> ::= "(" <expr> ")"

<func> ::= <symbol> "(" <expr-list> ")"

<expr-list> ::= <expr>
             |  <expr> "," <expr-list>

<binary> ::= <mul-div-ops>
          |  <mul-div-ops> ("+" | "-") <binary>

<mul-div-ops> ::= <non-binary>
               | <non-binary> ("*" | "/") <mul-div-ops>

<non-binary> ::= <subscript>
              |  <func>
              |  <field>
              |  <list-field>
              |  <num>
              |  <str>
              |  <paren>
```