[erlang-questions] My biggest beef with Erlang

Joe Armstrong erlang@REDACTED
Sun Nov 25 21:32:45 CET 2007

No this has nothing to do with regexps

-compile({character_transform, Mod}).

would (by analogy with parse_transform)
call Mod:character_transform(Bin, Opts) when Bin was the content of
the file being compiled
it would return Bin'

Then you could do anything you like.

-compile({tokenezer, Mod}).

could maybe call a custom tokeniser after character processing and
prior  to calling any
parse transforms.


On Nov 25, 2007 8:37 PM, Vlad Dumitrescu <vladdu55@REDACTED> wrote:
> Hi,
> On Nov 25, 2007 4:57 PM, Joe Armstrong <erlang@REDACTED> wrote:
> > I think it would be easier to allow syntax transforms *before*
> > parse_transform. We need
> > character_transform that kicks in before tokenisation, and
> > token_transform which kicks in after character_transform but before
> > parse_transform.
> Cool idea!
> But I'm not sure what char_transform would do. I suppose it can select
> strings with regexps,and do what to them? What it would be meaningful
> would be to replace them with tokens, as a sort of pre-tokenizer, but
> then the scanner should accept a stream of characters mixed with
> tokens.....
> Maybe token_transform is enough: given that the tokenizer will return
> any unmatched characters as their own tokens, a token_transform phase
> could take a sequence of two {'!', Line} tokens and compress them into
> a {'!!', Line} one. Possible troublemakers would be whitespaces, as we
> might want to convert two consecutive '!'s, without any intervening
> spaces.
> best regards,
> Vlad

More information about the erlang-questions mailing list