A.9 Scripts and Modules

  SourceFile:   ImplementationSourceFile   DeclarationSourceFile

  ImplementationSourceFile:   ImplementationScript   ImplementationModule

  DeclarationSourceFile:   DeclarationScript   DeclarationModule

  ImplementationScript:   ImplementationScriptElementsopt

  ImplementationScriptElements:   ImplementationScriptElement   ImplementationScriptElementsImplementationScriptElement

  ImplementationScriptElement:   ImplementationElement   AmbientModuleDeclaration

  ImplementationElement:   Statement   LexicalDeclaration   FunctionDeclaration   GeneratorDeclaration   ClassDeclaration   InterfaceDeclaration   TypeAliasDeclaration   EnumDeclaration   NamespaceDeclaration   AmbientDeclaration   ImportAliasDeclaration

  DeclarationScript:   DeclarationScriptElementsopt

  DeclarationScriptElements:   DeclarationScriptElement   DeclarationScriptElementsDeclarationScriptElement

  DeclarationScriptElement:   DeclarationElement   AmbientModuleDeclaration

  DeclarationElement:   InterfaceDeclaration   TypeAliasDeclaration   NamespaceDeclaration   AmbientDeclaration   ImportAliasDeclaration

  ImplementationModule:   ImplementationModuleElementsopt

  ImplementationModuleElements:   ImplementationModuleElement   ImplementationModuleElementsImplementationModuleElement

  ImplementationModuleElement:   ImplementationElement   ImportDeclaration   ImportAliasDeclaration   ImportRequireDeclaration   ExportImplementationElement   ExportDefaultImplementationElement   ExportListDeclaration   ExportAssignment

  DeclarationModule:   DeclarationModuleElementsopt

  DeclarationModuleElements:   DeclarationModuleElement   DeclarationModuleElementsDeclarationModuleElement

  DeclarationModuleElement:   DeclarationElement   ImportDeclaration   ImportAliasDeclaration   ExportDeclarationElement   ExportDefaultDeclarationElement   ExportListDeclaration   ExportAssignment

  ImportRequireDeclaration:   importBindingIdentifier=require(StringLiteral);

  ExportImplementationElement:   exportVariableStatement   exportLexicalDeclaration   exportFunctionDeclaration   exportGeneratorDeclaration   exportClassDeclaration   exportInterfaceDeclaration   exportTypeAliasDeclaration   exportEnumDeclaration   exportNamespaceDeclaration   exportAmbientDeclaration   exportImportAliasDeclaration

  ExportDeclarationElement:   exportInterfaceDeclaration   exportTypeAliasDeclaration   exportAmbientDeclaration   exportImportAliasDeclaration

  ExportDefaultImplementationElement:   exportdefaultFunctionDeclaration   exportdefaultGeneratorDeclaration   exportdefaultClassDeclaration   exportdefaultAssignmentExpression;

  ExportDefaultDeclarationElement:   exportdefaultAmbientFunctionDeclaration   exportdefaultAmbientClassDeclaration   exportdefaultIdentifierReference;

  ExportListDeclaration:   export*FromClause;   exportExportClauseFromClause;   exportExportClause;

  ExportAssignment:   export=IdentifierReference;