You are here:   ArielOrtiz.com > Compilers > Checklist: Semantic Analysis

Checklist: Semantic Analysis

A Griffin language compiler should produce a semantic error in each of the following cases:

  1. Declaring two global constants, variables, or procedures with the same name.
  2. Declaring two local constants, variables, or parameters with the same name.
  3. Integer literal greater than 231 – 1.
  4. List literal with two of more elements of different types.
  5. Empty list literal in a const section.
  6. Undeclared identifier used in any type of expression or in an assignment statement.
  7. Left-hand side type different from right-hand side type in an assignment statement.
  8. Non-list constant as the left-hand side of an assignment statement.
  9. Non-integer expression type used in a list index expression (lst[index]).
  10. Calling an undeclared procedure or a declared non-procedure. Using a procedure name without the calling syntax.
  11. Calling a procedure with a wrong number of arguments or with the wrong type of arguments.
  12. Calling a procedure that returns a value in a call procedure statement.
  13. Non-boolean expression used in if and elseif statements.
  14. for statement using undeclared variable.
  15. for statement iterating over a non-list expression type.
  16. for statement with variable type incompatible with list expression type.
  17. return statement with no expression when one should have been provided or with expression when none should have been provided.
  18. return statement with expression of the wrong type.
  19. exit statement used not within a loop or for statement.
  20. Incorrect type of operands used with any operator.