Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.compilers > #1172

Re: Trouble implementing a standard library -- Calling C functions from within my language

From Hans-Peter Diettrich <DrDiettrich1@aol.com>
Newsgroups comp.compilers
Subject Re: Trouble implementing a standard library -- Calling C functions from within my language
Date 2014-03-20 03:37 +0100
Organization Compilers Central
Message-ID <14-03-050@comp.compilers> (permalink)
References <14-03-049@comp.compilers>

Show all headers | View raw


noitalmost schrieb:

> And then have
> class CCall : public Expr
> {
>   CCall(string name, vector<Expr*> params);
>   string genC();
>   ...
> }
>
> where, Expr is a AstNode. But CCall::genC() would be a really
> complicated list of special cases.

Right now I see a problem with Expr (lval), when the C function
expects an pointer (rval). This should be handled at least for
variables, i.e.  Expr should include an hint on whether it *is* an
lval. When you produce C code, your data types already should match
the C definitions, else another transformation may be required for
passing parameters back and forth. All that should be built into Expr,
or a DataType member of Expr.

DoDi

Back to comp.compilers | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Trouble implementing a standard library -- Calling C functions from within my language noitalmost <noitalmost@cox.net> - 2014-03-19 18:28 -0400
  Re: Trouble implementing a standard library -- Calling C functions from within my language Hans-Peter Diettrich <DrDiettrich1@aol.com> - 2014-03-20 03:37 +0100
  Re: Trouble implementing a standard library -- Calling C functions from within my language alexfrunews@gmail.com - 2014-03-19 21:41 -0700
  Re: Trouble implementing a standard library -- Calling C functions from within my language noitalmost <noitalmost@cox.net> - 2014-03-21 14:49 -0400

csiph-web