naegling/src/c/day1.c

41 lines
1.2 KiB
C

/**
* day1.c
*
* Naegling: a compiling Beowulf reimplementation.
*
* Day 1 of work towards a compiler... eventually...
*
* This is a straight copy of Noah Zentzis' work. There's no original work of
* mine here, yet.
*
* See: https://generalproblem.net/lets_build_a_compiler/01-starting-out/
*
* I needed to install (on Debian) the package `gcc-multilib` to get this to
* link.
*
* The rest of day 1 is setting ip memory representation, which I've already
* done in `memory.h`, and which I'm consciously doing differently from the
* way that Zentis does it.
*
* (c) 2026 Simon Brooke <simon@journeyman.cc>
* Licensed under GPL version 2.0, or, at your option, any later version.
*/
#include <stdio.h>
#include <stdint.h>
#include <string.h>
/*
* "The `__attribute__((__cdecl__))` part is a GCC-specific syntax extension
* that tells the compiler to use the
* "[cdecl](https://en.wikipedia.org/wiki/X86_calling_conventions#cdecl)"
* calling convention when executing the function."
*/
__attribute__((__cdecl__))
extern int lisp_entry();
int main(int argc, const char **argv) {
int val = lisp_entry();
printf("%d\n", val);
return 0;
}