Last updated Oct 3, 2025

Jira expressions grammar

This page provides a formal BNF (Backus-Naur Form) grammar for the Jira expressions language. This grammar can be useful for:

  • Developers building parsers or syntax highlighters for Jira expressions
  • Understanding the formal structure and precedence rules of the language
  • Educational purposes and language reference

About This Grammar

This grammar is derived from the current implementation of the Jira expressions language and aims to accurately represent its syntax and structure. While it has not undergone exhaustive formal verification, it should provide a solid foundation for understanding the language's grammar rules and available constructs.

BNF Grammar

1
2
<program> ::= <top_level_let_in>

<top_level_let_in> ::= <variable_declarations> ";" <body_expression> ";"?
                     | <variable_declarations> ";" "return" <body_expression> ";"?
                     | "return" <body_expression> ";"?
                     | <body_expression> ";"?

<variable_declarations> ::= <variable_declaration> (";" <variable_declaration>)*

<variable_declaration> ::= ("let")? <identifier> "=" <expression>

<body_expression> ::= <expression>
                    | <if_statement>
                    | <try_statement>

<if_statement> ::= "if" "(" <expression> ")" <block> <else_if_clause>* <else_clause>

<else_if_clause> ::= "else" "if" "(" <expression> ")" <block>

<else_clause> ::= "else" <block>

<try_statement> ::= "try" <block> "catch" "(" <identifier>? ")" <block>

<block> ::= "{" <top_level_let_in> "}"

<expression> ::= <conditional_expression>

<conditional_expression> ::= <throw_expression> ("?" <expression> ":" <conditional_expression>)?

<throw_expression> ::= "throw" <throw_expression>
                     | <nullish_coalescing_expression>

<nullish_coalescing_expression> ::= <logical_or_expression> ("??" <logical_or_expression>)*

<logical_or_expression> ::= <logical_and_expression> ("||" <logical_and_expression>)*

<logical_and_expression> ::= <equality_expression> ("&&" <equality_expression>)*

<equality_expression> ::= <relational_expression> (("==" | "!=") <relational_expression>)*

<relational_expression> ::= <additive_expression> (("<" | ">" | "<=" | ">=") <additive_expression>)*

<additive_expression> ::= <multiplicative_expression> (("+" | "-") <multiplicative_expression>)*

<multiplicative_expression> ::= <unary_expression> (("*" | "/" | "%") <unary_expression>)*

<unary_expression> ::= ("!" | "-" | "typeof") <unary_expression>
                     | <postfix_expression>

<postfix_expression> ::= <primary_expression> <postfix_suffix>*

<postfix_suffix> ::= "." <identifier>
                   | "?." <identifier>
                   | "[" <expression> "]"
                   | "?.[" <expression> "]"
                   | "(" <argument_list> ")"

<primary_expression> ::= <literal>
                       | <identifier>
                       | <lambda_expression>
                       | <constructor_call>
                       | <array_literal>
                       | <object_literal>
                       | <template_literal>
                       | "(" <expression> ")"

<literal> ::= <number>
            | <string>
            | <boolean>
            | "null"

<number> ::= [0-9]+ ("." [0-9]+)?

<string> ::= "'" <single_string_content>* "'"
           | "\"" <double_string_content>* "\""

<character> ::= [a-z] | [A-Z] | [0-9] | " " | "!" | "#" | "$" | "%" | "&" | "(" | ")" | "*" | "+" | "," | "-" | "." | "/" | ":" | ";" | "<" | "=" | ">" | "?" | "@" | "[" | "]" | "^" | "_" | "`" | "{" | "|" | "}" | "~"

<single_string_content> ::= <character> | "\""

<double_string_content> ::= <character> | "'"

<boolean> ::= "true" | "false"

<identifier> ::= <identifier_char>+

<identifier_char> ::= [a-z] | [A-Z] | "_" | "$" | [0-9]

<template_literal> ::= "`" <template_part>* "`"

<template_part> ::= <template_content> | "${" <expression> "}"

<template_content> ::= <character> | "\"" | "'"

<lambda_expression> ::= <lambda_params> "=>" <lambda_body>

<lambda_params> ::= <identifier>
                  | "(" <parameter_list> ")"

<parameter_list> ::= <identifier> ("," <identifier>)*
                   | E

<lambda_body> ::= <expression>
                | <block>

<constructor_call> ::= "new" <identifier> "(" <argument_list> ")"

<argument_list> ::= <expression> ("," <expression>)*
                  | E

<array_literal> ::= "[" <element_list> "]"

<element_list> ::= <expression> ("," <expression>)*
                 | E

<object_literal> ::= "{" <property_list> "}"

<property_list> ::= <property> ("," <property>)*
                  | E

<property> ::= <identifier> ":" <expression>

Rate this page: