|Implementing built-in functions with LLVM, help needed firstname.lastname@example.org (Ivan Espinosa) (2022-10-03)|
|Re: Implementing built-in functions with LLVM, help needed email@example.com (2022-10-06)|
|Implementing built-in functions with LLVM, help needed firstname.lastname@example.org (Christopher F Clark) (2022-10-07)|
|Re: Implementing built-in functions with LLVM, help needed DrDiettrich1@netscape.net (Hans-Peter Diettrich) (2022-10-07)|
|Re: Implementing built-in functions with LLVM, help needed email@example.com (2022-10-13)|
|Date:||Thu, 13 Oct 2022 14:08:15 -0000 (UTC)|
|Organization:||Aioe.org NNTP Server|
|Injection-Info:||gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="75194"; mail-complaints-to="firstname.lastname@example.org"|
|Posted-Date:||13 Oct 2022 10:19:32 EDT|
Christopher F Clark <email@example.com> wrote:
> I'm surprised no one has chimed in yet, so I will.
> > How should I implement functions like writeln, read, etc?
> I presume you have a design for "user defined" functions and
> procedures. If not, you need that first. That is roughly how you pass
> in parameters and receive return values. Usually there is a convention
> (often defined by the OS or these days the C compiler) that one
> follows to do that.
> But once you have that, you can call functions. And, if it is a
> convention suitable for C, it specifies how you handle variadic
> functions, functions that take a variable number of arguments like
Treating writeln via variable argument call is wrong. Compiler
is supposed to split writeln into separate simpler statements.
This leads to subtle difference, folks trying to implement
Pascal via C-like approach at some moment learn the difference
and fix their compilers, but it is better to get it right the
> Now, you may need some Pascal specific wrinkles because the
> Pascal language supports things like variables from the parent scope
> (a subset of the closure concept) and for writeln knowing the type of
> the variable passed so that you can format it properly
Syntax of buitins is different that normal calls, that is easy
to handle in parser but must be done before call. And builtins
are overloaded, in dialects with many builtins handling of
overloading may take most of implementation.
> Still, the ability to call functions is the key thing you need to do.
Return to the
Search the comp.compilers archives again.