Jokes aside, you could easily write a preprocessor to do that. If the syntax you want is along the lines of
keyword identifier { body }
keyword identifier
it's just a matter of matching tokens, counting brackets and then replacing forms.With that being said, the examples sounds like making busy-work for yourself. The "module" would still suffer from monkeypatching-related collisions (e.g. think document.getElementsByClassName in old versions of Prototype.js).
Also, javascript has both statements and expressions, so hypothetical macro-enhanced code like this
var a = module A {}
would break depending on what "module" expands to.