Language: C++

#include <iostream>
#include <string>
#include <regex>
#include <vector>
#include <map>

using namespace std;

string str;
int array_size[58] = {};
map<int, int> values[58];
regex re_left(R"((.)\[([^=]+)\](.*))");
regex re_right(R"(=(.+))");

int valueOf(string s) {
    smatch m;
    if (regex_match(s, m, re_left)) {
        int array_name = (int)(m[1].str()[0]-'A');
        int index = valueOf(m[2].str());
        if (array_size[array_name] <= index) return -1;
        else {
            auto it = values[array_name].find(index);
            if (it != values[array_name].end()) return it->second;
            else return -1;
        }
    } else {
        return stoi(s);
    }
}

int main() {
    cin>>str;
    while (str[0] != '.') {
        vector<string> program;
        for (int i = 0; i < 58; i++) {
            array_size[i] = 0;
            values[i].clear();
        }
        while (str[0] != '.') {
            program.push_back(str);
            cin>>str;
        }

        smatch match;
        for (int l = 0; l < program.size(); l++) {
            if (regex_match(program[l], match, re_left)) {
                int array_name = (int)(match[1].str()[0]-'A');
                int index = valueOf(match[2].str());
                if (match[3].str().empty()) array_size[array_name] = index;
                else {
                    if (array_size[array_name] <= index) {
                        cout<<l+1<<endl;
                        break;
                    } else if (regex_match(match[3].str(), match, re_right)) {
                        int value = valueOf(match[1]);
                        if (value == -1) {
                            cout<<l+1<<endl;
                            break;
                        } else values[array_name][index] = value;
                    }
                }
            }
            if (l == program.size()-1) cout<<"0"<<endl;
        }
        cin>>str;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:54:43: error: use of deleted function 'bool std::regex_match(const __cxx11::basic_string<_Ch_type, _Ch_traits, _Ch_alloc>&&, __cxx11::match_results<typename __cxx11::basic_string<_Ch_type, _Ch_traits, _Ch_alloc>::const_iterator, _Alloc>&, const __cxx11::basic_regex<_Ch_type, _Rx_traits>&, regex_constants::match_flag_type) [with _Ch_traits = char_traits<char>; _Ch_alloc = allocator<char>; _Alloc = allocator<__cxx11::sub_match<__gnu_cxx::__normal_iterator<const char*, __cxx11::basic_string<char> > > >; _Ch_type = char; _Rx_traits = __cxx11::regex_traits<char>; typename __cxx11::basic_string<_Ch_type, _Ch_traits, _Ch_alloc>::const_iterator = __cxx11::basic_string<char>::const_iterator]'
   54 |                     } else if (regex_match(match[3].str(), match, re_right)) {
      |                                ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/regex:68,
                 from a.cc:3:
/usr/include/c++/14/bits/regex.h:2351:5: note: declared here
 2351 |     regex_match(const basic_string<_Ch_type, _Ch_traits, _Ch_alloc>&&,
      |     ^~~~~~~~~~~
a.cc:54:43: note: use '-fdiagnostics-all-candidates' to display considered candidates
   54 |                     } else if (regex_match(match[3].str(), match, re_right)) {
      |                                ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~