tingwei628 / bfcs

brainfuck in C#
MIT License
1 stars 1 forks source link

O(n^2) too slow #1

Closed tingwei628 closed 2 years ago

tingwei628 commented 4 years ago

review source

Throw out lines 139-158, which are a slow unnecessary mess. In their place: Put left bracket in the left node. Then call _program() and put the return in the middle node. Whether it's null or not (don't even need to check, I don't think). Then get the next token and make sure it's a right bracket. If so, put it in right node; if not, note an unmatched '[' error.