Todos los libros

Profesional

Apps Acerca de Coach Iniciar sesión Empezar a leer

Computer Science · Glosario

¿Qué es Static semantics, type checking?

También llamado: static semantics · type checking

Definition 4.5 University Computer Science — Year 3 · Capítulo 4 — Abstract Syntax and Semantic Analysis

The static semantics of a language is the set of rules a program must satisfy beyond its grammar, checked before it runs: every name declared, every operator applied to operands of the right types, every function returning on every path. Type checking is the part of it that gives every expression of a program a type and checks that each construct receives operands of the types it requires.

A typing derivation for one statement, with = x: int, y: int, limit: int. The leaves look names up in ; each line is one rule. An if without else has the same rule without B_2.
A typing derivation for one statement, with Γ=x:int,y:int,limit:int\Gamma = \mathtt{x}{:}\mathsf{int}, \mathtt{y}{:}\mathsf{int}, \mathtt{limit}{:}\mathsf{int}. The leaves look names up in Γ\Gamma; each line is one rule. An if without else has the same rule without B2B_2.
Leer en el capítulo →