Break keyword outside a loop is syntax error or semantic error?
Both work, so how you do it is up to you. But there are a couple of reasons to consider doing it during a post-parse analysis:

While it is certainly possible to define two different types of block, one in which break is legal and the other one in which it isn't, the result is a lot of duplication in the grammar, and a certain complication because you have to allow break inside blocks which are themselves contained inside a looping construct. If you allow compound statements without explicit blocks, like if (condition) break;, then you also need to define different if statements, etc. This rapidly gets out of hand unless you have a tagged formalism like that used in ECMAScript.

Detecting the error in a post-parse scan will allow you to produce better error messages. Rather than just presenting the user with some kind of syntax error message (which might be &quot;unexpected token 'break'&quot;), you can actually provide a meaningful error message like &quot;'break' statement cannot be used outside of a loop.&quot;