[erlang-questions] comma-less lists and tuples

Vlad Dumitrescu vladdu55@REDACTED
Thu Sep 21 12:38:09 CEST 2006


On 9/21/06, Ulf Wiger (TN/EAB) <ulf.wiger@REDACTED> wrote:
> Vlad Dumitrescu wrote:
> > How could the Erlang compiler help me write better SQL
> > statements? Yes, if I write quasi-SQL, I get some syntax
> > checking, but I still can write stupid things like
> >     {select, {where, {x, '=', 3}}, foo, {from, [table]}}
> > which is a correct Erlang term, but not correct quasi-SQL.
> Well, that would be the task of a domain-specific parser,
> or a parse_transform.

Yes, of course. This is what I was trying to say too, but didn't
manage to express my self as clearly.

> Departing from Erlang syntax is tricky in a parse transform,
> since the erlang tokenizer and parser will get hold of it
> before your parse transform.

This might get a solution, "Quite Soon (tm)"-ish.

> A MSc student did write an SQL parser converting SQL
> to Mnemosyne queries. This worked quite well. Going
> from a QLC query to SQL should be doable, and - assuming
> I'm right - raises the argument that Erlang already
> _has_ quite a powerful syntax for database queries.
> So why invent a new one?

Very good point. But this wouldn't make the discussion obsolete
because there might be other DSLs that one might want to use besides
sql.

best regards,
Vlad



More information about the erlang-questions mailing list