Basic frontend (scoping rules and type checking)