Ticket #112 (closed enhancement)

Opened 16 years ago

Last modified 16 years ago

implement modules

Reported by: dherman Owned by: dherman
Priority: critical Milestone:
Component: dherman/javascript.plt Keywords:
Cc: Version:
Racket Version: 4.0

Description

Implement a #lang module language that supports imports and exports using the following grammar:

Declaration ::= ... | Import | Export
Import ::= 'import' (ImportSpec)','+ ';'?
Export ::= 'export' (ExportSpec)','+ ';'?

Names ::= Identifier
       |  StringLiteral
       |  '(' (Identifier | StringLiteral)','+ ')'

ImportSpec ::= ModuleName '.' '*' ('-' Names)?
            |  ModuleName '.' Identifier ('as' Identifier)?
            |  ModuleName '[' StringLiteral ']' 'as' Identifier
ExportSpec ::= Identifier ('as' Identifier)?

Change History

Changed 16 years ago by dherman

Declaration ::= ... | Import | Export
Import ::= 'import' ImportSpec ';'?
Export ::= 'export' ExportSpec ';'?

Names ::= Identifier
       |  StringLiteral
       |  '(' (Identifier | StringLiteral)','+ ')'

ModuleName ::= (Identifier)'.'+

ImportSpec ::= ModuleName '.' '*' ('-' Names)?
            |  ModuleName '.' Identifier ('as' Identifier)?
            |  ModuleName '[' StringLiteral ']' 'as' Identifier
ExportSpec ::= Identifier ('as' Identifier)?
            |  '*' ('-' Names)?

Changed 16 years ago by dherman

Should also allow an "all-from" export form, e.g.:

import foo.*;

export foo.* - (baz, bar);

Changed 16 years ago by dherman

Declaration ::= ... | Import | Export

Import ::= 'import' (ImportSpec)','+ ';'?
Export ::= 'export' (ExportSpec)','+ ';'?

Names ::= Identifier
       |  StringLiteral
       |  '(' (Identifier | StringLiteral)','+ ')'

ModuleName ::= Protocol '(' StringLiteral ')'
            |  (Identifier)'/'+

ImportSpec ::= ModuleName '.' '*' ('-' Names)?
            |  ModuleName '.' Identifier ('as' Identifier)?
            |  ModuleName '[' StringLiteral ']' 'as' Identifier

ExportSpec ::= Identifier ('as' Identifier)?
            |  '*' ('-' Names)?

Changed 16 years ago by dherman

Declaration ::= ... | Import | Export

Import ::= 'import' (ImportSpec)','+ ';'?
Export ::= 'export' (ExportSpec)','+ ';'?

Names ::= Identifier
       |  StringLiteral
       |  '(' (Identifier | StringLiteral)','+ ')'

ModuleName ::= Protocol '(' StringLiteral ')'
            |  (Identifier)'/'+

Protocol ::= 'file' | 'planet'

ImportSpec ::= ModuleName '.' '*' ('-' Names)?
            |  ModuleName '.' Identifier ('as' Identifier)?
            |  ModuleName '[' StringLiteral ']' 'as' Identifier

ExportSpec ::= Identifier ('as' Identifier)?
            |  '*' ('-' Names)?
            |  ModuleName '.' '*' ('-' Names)?

Changed 16 years ago by dherman

Declaration ::= ... | Import | Export

Import ::= 'import' (ImportSpec)','+ ';'?
Export ::= 'export' (ExportSpec)','+ ';'?

Exclusion ::= Identifier
           |  StringLiteral
           |  '(' (Identifier | StringLiteral)','+ ')'

ModuleSpec ::= Protocol '(' (ProtocolArg?)','* ')'
            |  (Identifier)'/'+

Protocol ::= 'file' | 'planet'

ProtocolArg ::= StringLiteral | IntLiteral

ImportSpec ::= ModuleSpec '.' ImportBindings

ImportBindings ::= '*' ('-' Exclusion)?
                |  Identifier
                |  '{' (ImportBinding)','* '}'

ImportBinding ::= Identifier (':' Identifier)?
               |  StringLiteral ':' Identifier

ExportSpec ::= Identifier ('as' Identifier)?
            |  '*' ('-' Exclusion)?
            |  ModuleSpec '.' '*' ('-' Exclusion)?

Changed 16 years ago by dherman

Declaration ::= ... | Import | Export

Import ::= 'import' (ImportSpec)','+ ';'?
Export ::= 'export' (ExportSpec)','+ ';'?

Exclusion ::= Identifier
           |  StringLiteral
           |  '(' (Identifier | StringLiteral)','+ ')'

ModuleSpec ::= Protocol '(' (ProtocolArg?)','* ')'
            |  (Identifier)'/'+

Protocol ::= 'file' | 'planet'

ProtocolArg ::= StringLiteral | IntLiteral

ImportSpec ::= ModuleSpec '.' ImportBindings

ImportBindings ::= '*' ('-' Exclusion)?
                |  Identifier
                |  '{' (ImportBinding)','* '}'

ImportBinding ::= Identifier (':' Identifier)?
               |  StringLiteral ':' Identifier

ExportSpec ::= (ModuleSpec '.')? '*' ('-' Exclusion)?
            |  '{' (ExportBinding)','* '}'
            |  Identifier

ExportBinding ::= Identifier (':' Expression)?

Changed 16 years ago by dherman

  • status changed from new to closed

Implemented in 8:0.

Note: See TracTickets for help on using tickets.