I am using lex/yacc to parse a simple language which allows 'if blocks':

IF something
  [ELSE IF something][ELSE]

and also other nested logic under a 'DEFINE' statement:

DEFINE something
  something else

I am in need of a common term to refer to these blocks (as the name of a container class). I have thought of Flow Control but it does not seem to correctly capture the intent...?

  • 1
    If-Statements, Loops, try-catch-finally, switch tables and gotos are control structures. Does that fit? I have never seen a define block, though. What language is that from? – marstato Jun 28 '17 at 9:14
  • It's a custom language for some simulation software input file. Apparently based on VBA macros. Control structure works well. If you add it as an answer I can accept it – jramm Jun 28 '17 at 9:16
  • A type/class definition or a function body can be seen as define blocks. – mouviciel Jun 28 '17 at 13:55
  • Collectively, any control structure that involves a condition (including loops) is called a branch. – Robert Harvey Jun 11 '19 at 4:25

To my best knowledge, control structures is the term used for if statements, loops, try-catch-finally, switch tables and gotos in C-like languages.

| improve this answer | |

There are three fundamental programming constructs in Computer Science; these are Sequence, Selection and Iteration. These are Computer Science terms and apply across actual languages.

So in this case your IF is a Selection and your DEFINE is a sequence.

| improve this answer | |
  • 3
    is this merely your opinion or you can back it up somehow? – gnat Jun 28 '17 at 11:23
  • What about Occam PAR instruction, or bash pipe ? – mouviciel Jun 28 '17 at 13:59
  • 1
    Interesting thoughts and I'm sure such terms will come in useful elsewhere, but unfortunately it doesn't provide a common term for both types of blocks I asked for – jramm Jun 29 '17 at 7:18
  • @gnat It is a Computer Science 101 topic since I did my CS degree 20 years ago ;) goo.gl/ms23Wd – Martin Spamer Jun 29 '17 at 9:04
  • wonder how readers of this answer are expected to find that out – gnat Jun 29 '17 at 9:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.