-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compiling a simple hello world program #20
Comments
With 7222741 the compiler no longer crashes but you need to add your own minimal // minimal stddef.h
typedef long ptrdiff_t;
typedef unsigned long size_t;
typedef int wchar_t;
#define NULL ((void*)0) With all that there are still a bunch of compiler errors due to bugs and unimplemented features. |
Now I get
I guess I'll have to define Any help with that? |
You don't need to but it isn't able to find the correct headers. Can you give |
Okay, I cut pasted it from I pasted it back and made a symlink in via ↯ v0.9.0-dev.861+311797f68
❯ arocc test.c -o test
/usr/include/bits/wordsize.h:4:10: warning: '__WORDSIZE' macro redefined
# define __WORDSIZE 64
^
/usr/include/bits/wordsize.h:12:10: warning: '__WORDSIZE_TIME64_COMPAT32' macro redefined
# define __WORDSIZE_TIME64_COMPAT32 1
^
/usr/include/bits/wordsize.h:14:10: warning: '__SYSCALL_WORDSIZE' macro redefined
# define __SYSCALL_WORDSIZE 64
^
/usr/include/bits/long-double.h:21:9: warning: '__LDOUBLE_REDIRECTS_TO_FLOAT128_ABI' macro redefined
#define __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI 0
^
4 warnings generated.
typedef: 'long'
name: ptrdiff_t
typedef: 'unsigned long'
name: size_t
typedef: 'int'
name: wchar_t
struct_decl_two: 'struct (anonymous struct at /home/varlad/arocc/include/stddef.h:10:9)'
record_field_decl: 'long long'
name: __aro_max_align_ll
record_field_decl: 'long double'
name: __aro_max_align_ld
typedef: 'struct (anonymous struct at /home/varlad/arocc/include/stddef.h:10:9)'
name: max_align_t
typedef: 'int'
name: va_list
typedef: 'int'
name: __gnuc_va_list
typedef: 'unsigned char'
name: __u_char
typedef: 'unsigned short'
name: __u_short
typedef: 'unsigned int'
name: __u_int
typedef: 'unsigned long'
name: __u_long
typedef: 'signed char'
name: __int8_t
typedef: 'unsigned char'
name: __uint8_t
typedef: 'short'
name: __int16_t
typedef: 'unsigned short'
name: __uint16_t
typedef: 'int'
name: __int32_t
typedef: 'unsigned int'
name: __uint32_t
typedef: 'long'
name: __int64_t
typedef: 'unsigned long'
name: __uint64_t
typedef: 'signed char'
name: __int_least8_t
typedef: 'unsigned char'
name: __uint_least8_t
typedef: 'short'
name: __int_least16_t
typedef: 'unsigned short'
name: __uint_least16_t
typedef: 'int'
name: __int_least32_t
typedef: 'unsigned int'
name: __uint_least32_t
typedef: 'long'
name: __int_least64_t
typedef: 'unsigned long'
name: __uint_least64_t
typedef: 'long'
name: __quad_t
typedef: 'unsigned long'
name: __u_quad_t
typedef: 'long'
name: __intmax_t
typedef: 'unsigned long'
name: __uintmax_t
typedef: 'unsigned long'
name: __dev_t
typedef: 'unsigned int'
name: __uid_t
typedef: 'unsigned int'
name: __gid_t
typedef: 'unsigned long'
name: __ino_t
typedef: 'unsigned long'
name: __ino64_t
typedef: 'unsigned int'
name: __mode_t
typedef: 'unsigned long'
name: __nlink_t
typedef: 'long'
name: __off_t
typedef: 'long'
name: __off64_t
typedef: 'int'
name: __pid_t
struct_decl_two: 'struct (anonymous struct at /usr/include/bits/typesizes.h:73:24)'
record_field_decl: '[2]int'
name: __val
typedef: 'struct (anonymous struct at /usr/include/bits/typesizes.h:73:24)'
name: __fsid_t
typedef: 'long'
name: __clock_t
typedef: 'unsigned long'
name: __rlim_t
typedef: 'unsigned long'
name: __rlim64_t
typedef: 'unsigned int'
name: __id_t
typedef: 'long'
name: __time_t
typedef: 'unsigned int'
name: __useconds_t
typedef: 'long'
name: __suseconds_t
typedef: 'long'
name: __suseconds64_t
typedef: 'int'
name: __daddr_t
typedef: 'int'
name: __key_t
typedef: 'int'
name: __clockid_t
typedef: '*void'
name: __timer_t
typedef: 'long'
name: __blksize_t
typedef: 'long'
name: __blkcnt_t
typedef: 'long'
name: __blkcnt64_t
typedef: 'unsigned long'
name: __fsblkcnt_t
typedef: 'unsigned long'
name: __fsblkcnt64_t
typedef: 'unsigned long'
name: __fsfilcnt_t
typedef: 'unsigned long'
name: __fsfilcnt64_t
typedef: 'long'
name: __fsword_t
typedef: 'long'
name: __ssize_t
typedef: 'long'
name: __syscall_slong_t
typedef: 'unsigned long'
name: __syscall_ulong_t
typedef: 'long'
name: __loff_t
typedef: '*char'
name: __caddr_t
typedef: 'long'
name: __intptr_t
typedef: 'unsigned int'
name: __socklen_t
typedef: 'int'
name: __sig_atomic_t
struct_decl: 'struct (anonymous struct at /usr/include/bits/types/__mbstate_t.h:13:9)'
record_field_decl: 'int'
name: __count
union_decl_two: 'union (anonymous union at /usr/include/bits/types/__mbstate_t.h:16:3)'
record_field_decl: 'unsigned int'
name: __wch
record_field_decl: '[4]char'
name: __wchb
record_field_decl: 'union (anonymous union at /usr/include/bits/types/__mbstate_t.h:16:3)'
name: __value
typedef: 'struct (anonymous struct at /usr/include/bits/types/__mbstate_t.h:13:9)'
name: __mbstate_t
struct_decl_two: 'struct _G_fpos_t'
record_field_decl: 'long'
name: __pos
record_field_decl: 'struct (anonymous struct at /usr/include/bits/types/__mbstate_t.h:13:9)'
name: __state
typedef: 'struct _G_fpos_t'
name: __fpos_t
struct_decl_two: 'struct _G_fpos64_t'
record_field_decl: 'long'
name: __pos
record_field_decl: 'struct (anonymous struct at /usr/include/bits/types/__mbstate_t.h:13:9)'
name: __state
typedef: 'struct _G_fpos64_t'
name: __fpos64_t
typedef: 'struct _IO_FILE'
name: __FILE
typedef: 'struct _IO_FILE'
name: FILE
typedef: 'void'
name: _IO_lock_t
struct_decl: 'struct _IO_FILE'
record_field_decl: 'int'
name: _flags
record_field_decl: '*char'
name: _IO_read_ptr
record_field_decl: '*char'
name: _IO_read_end
record_field_decl: '*char'
name: _IO_read_base
record_field_decl: '*char'
name: _IO_write_base
record_field_decl: '*char'
name: _IO_write_ptr
record_field_decl: '*char'
name: _IO_write_end
record_field_decl: '*char'
name: _IO_buf_base
record_field_decl: '*char'
name: _IO_buf_end
record_field_decl: '*char'
name: _IO_save_base
record_field_decl: '*char'
name: _IO_backup_base
record_field_decl: '*char'
name: _IO_save_end
record_field_decl: '*struct _IO_marker'
name: _markers
record_field_decl: '*struct _IO_FILE'
name: _chain
record_field_decl: 'int'
name: _fileno
record_field_decl: 'int'
name: _flags2
record_field_decl: 'long'
name: _old_offset
record_field_decl: 'unsigned short'
name: _cur_column
record_field_decl: 'signed char'
name: _vtable_offset
record_field_decl: '[1]char'
name: _shortbuf
record_field_decl: '*void'
name: _lock
record_field_decl: 'long'
name: _offset
record_field_decl: '*struct _IO_codecvt'
name: _codecvt
record_field_decl: '*struct _IO_wide_data'
name: _wide_data
record_field_decl: '*struct _IO_FILE'
name: _freeres_list
record_field_decl: '*void'
name: _freeres_buf
record_field_decl: 'unsigned long'
name: __pad5
record_field_decl: 'int'
name: _mode
record_field_decl: '[20]char'
name: _unused2
typedef: 'long'
name: off_t
typedef: 'long'
name: ssize_t
typedef: 'struct _G_fpos_t'
name: fpos_t
extern_var: '*struct _IO_FILE'
name: stdin
extern_var: '*struct _IO_FILE'
name: stdout
extern_var: '*struct _IO_FILE'
name: stderr
fn_proto: 'fn (__filename: *const char) int'
name: remove
fn_proto: 'fn (__old: *const char, __new: *const char) int'
name: rename
fn_proto: 'fn (__oldfd: int, __old: *const char, __newfd: int, __new: *const char) int'
name: renameat
fn_proto: 'fn () *struct _IO_FILE'
name: tmpfile
fn_proto: 'fn (__s: *char) *char'
name: tmpnam
fn_proto: 'fn (__s: *char) *char'
name: tmpnam_r
fn_proto: 'fn (__dir: *const char, __pfx: *const char) *char'
name: tempnam
fn_proto: 'fn (__stream: *struct _IO_FILE) int'
name: fclose
fn_proto: 'fn (__stream: *struct _IO_FILE) int'
name: fflush
fn_proto: 'fn (__stream: *struct _IO_FILE) int'
name: fflush_unlocked
fn_proto: 'fn (__filename: restrict *const char, __modes: restrict *const char) *struct _IO_FILE'
name: fopen
fn_proto: 'fn (__filename: restrict *const char, __modes: restrict *const char, __stream: restrict *struct _IO_FILE) *struct _IO_FILE'
name: freopen
fn_proto: 'fn (__fd: int, __modes: *const char) *struct _IO_FILE'
name: fdopen
fn_proto: 'fn (__s: *void, __len: unsigned long, __modes: *const char) *struct _IO_FILE'
name: fmemopen
fn_proto: 'fn (__bufloc: **char, __sizeloc: *unsigned long) *struct _IO_FILE'
name: open_memstream
fn_proto: 'fn (__stream: restrict *struct _IO_FILE, __buf: restrict *char) void'
name: setbuf
fn_proto: 'fn (__stream: restrict *struct _IO_FILE, __buf: restrict *char, __modes: int, __n: unsigned long) int'
name: setvbuf
fn_proto: 'fn (__stream: restrict *struct _IO_FILE, __buf: restrict *char, __size: unsigned long) void'
name: setbuffer
fn_proto: 'fn (__stream: *struct _IO_FILE) void'
name: setlinebuf
fn_proto: 'fn (__stream: restrict *struct _IO_FILE, __format: restrict *const char, ...) int'
name: fprintf
fn_proto: 'fn (__format: restrict *const char, ...) int'
name: printf
fn_proto: 'fn (__s: restrict *char, __format: restrict *const char, ...) int'
name: sprintf
fn_proto: 'fn (__s: restrict *struct _IO_FILE, __format: restrict *const char, __arg: int) int'
name: vfprintf
fn_proto: 'fn (__format: restrict *const char, __arg: int) int'
name: vprintf
fn_proto: 'fn (__s: restrict *char, __format: restrict *const char, __arg: int) int'
name: vsprintf
fn_proto: 'fn (__s: restrict *char, __maxlen: unsigned long, __format: restrict *const char, ...) int'
name: snprintf
fn_proto: 'fn (__s: restrict *char, __maxlen: unsigned long, __format: restrict *const char, __arg: int) int'
name: vsnprintf
fn_proto: 'fn (__fd: int, __fmt: restrict *const char, __arg: int) int'
name: vdprintf
fn_proto: 'fn (__fd: int, __fmt: restrict *const char, ...) int'
name: dprintf
fn_proto: 'fn (__stream: restrict *struct _IO_FILE, __format: restrict *const char, ...) int'
name: fscanf
fn_proto: 'fn (__format: restrict *const char, ...) int'
name: scanf
fn_proto: 'fn (__s: restrict *const char, __format: restrict *const char, ...) int'
name: sscanf
typedef: 'float'
name: _Float32
typedef: 'double'
name: _Float64
typedef: 'double'
name: _Float32x
typedef: 'long double'
name: _Float64x
fn_proto: 'fn (__stream: restrict *struct _IO_FILE, __format: restrict *const char, ...) int'
name: __isoc99_fscanf
fn_proto: 'fn (__format: restrict *const char, ...) int'
name: __isoc99_scanf
fn_proto: 'fn (__s: restrict *const char, __format: restrict *const char, ...) int'
name: __isoc99_sscanf
fn_proto: 'fn (__s: restrict *struct _IO_FILE, __format: restrict *const char, __arg: int) int'
name: vfscanf
fn_proto: 'fn (__format: restrict *const char, __arg: int) int'
name: vscanf
fn_proto: 'fn (__s: restrict *const char, __format: restrict *const char, __arg: int) int'
name: vsscanf
fn_proto: 'fn (__s: restrict *struct _IO_FILE, __format: restrict *const char, __arg: int) int'
name: __isoc99_vfscanf
fn_proto: 'fn (__format: restrict *const char, __arg: int) int'
name: __isoc99_vscanf
fn_proto: 'fn (__s: restrict *const char, __format: restrict *const char, __arg: int) int'
name: __isoc99_vsscanf
fn_proto: 'fn (__stream: *struct _IO_FILE) int'
name: fgetc
fn_proto: 'fn (__stream: *struct _IO_FILE) int'
name: getc
fn_proto: 'fn () int'
name: getchar
fn_proto: 'fn (__stream: *struct _IO_FILE) int'
name: getc_unlocked
fn_proto: 'fn () int'
name: getchar_unlocked
fn_proto: 'fn (__stream: *struct _IO_FILE) int'
name: fgetc_unlocked
fn_proto: 'fn (__c: int, __stream: *struct _IO_FILE) int'
name: fputc
fn_proto: 'fn (__c: int, __stream: *struct _IO_FILE) int'
name: putc
fn_proto: 'fn (__c: int) int'
name: putchar
fn_proto: 'fn (__c: int, __stream: *struct _IO_FILE) int'
name: fputc_unlocked
fn_proto: 'fn (__c: int, __stream: *struct _IO_FILE) int'
name: putc_unlocked
fn_proto: 'fn (__c: int) int'
name: putchar_unlocked
fn_proto: 'fn (__stream: *struct _IO_FILE) int'
name: getw
fn_proto: 'fn (__w: int, __stream: *struct _IO_FILE) int'
name: putw
fn_proto: 'fn (__s: restrict *char, __n: int, __stream: restrict *struct _IO_FILE) *char'
name: fgets
fn_proto: 'fn (__lineptr: restrict **char, __n: restrict *unsigned long, __delimiter: int, __stream: restrict *struct _IO_FILE) long'
name: __getdelim
fn_proto: 'fn (__lineptr: restrict **char, __n: restrict *unsigned long, __delimiter: int, __stream: restrict *struct _IO_FILE) long'
name: getdelim
fn_proto: 'fn (__lineptr: restrict **char, __n: restrict *unsigned long, __stream: restrict *struct _IO_FILE) long'
name: getline
fn_proto: 'fn (__s: restrict *const char, __stream: restrict *struct _IO_FILE) int'
name: fputs
fn_proto: 'fn (__s: *const char) int'
name: puts
fn_proto: 'fn (__c: int, __stream: *struct _IO_FILE) int'
name: ungetc
fn_proto: 'fn (__ptr: restrict *void, __size: unsigned long, __n: unsigned long, __stream: restrict *struct _IO_FILE) unsigned long'
name: fread
fn_proto: 'fn (__ptr: restrict *const void, __size: unsigned long, __n: unsigned long, __s: restrict *struct _IO_FILE) unsigned long'
name: fwrite
fn_proto: 'fn (__ptr: restrict *void, __size: unsigned long, __n: unsigned long, __stream: restrict *struct _IO_FILE) unsigned long'
name: fread_unlocked
fn_proto: 'fn (__ptr: restrict *const void, __size: unsigned long, __n: unsigned long, __stream: restrict *struct _IO_FILE) unsigned long'
name: fwrite_unlocked
fn_proto: 'fn (__stream: *struct _IO_FILE, __off: long, __whence: int) int'
name: fseek
fn_proto: 'fn (__stream: *struct _IO_FILE) long'
name: ftell
fn_proto: 'fn (__stream: *struct _IO_FILE) void'
name: rewind
fn_proto: 'fn (__stream: *struct _IO_FILE, __off: long, __whence: int) int'
name: fseeko
fn_proto: 'fn (__stream: *struct _IO_FILE) long'
name: ftello
fn_proto: 'fn (__stream: restrict *struct _IO_FILE, __pos: restrict *struct _G_fpos_t) int'
name: fgetpos
fn_proto: 'fn (__stream: *struct _IO_FILE, __pos: *const struct _G_fpos_t) int'
name: fsetpos
fn_proto: 'fn (__stream: *struct _IO_FILE) void'
name: clearerr
fn_proto: 'fn (__stream: *struct _IO_FILE) int'
name: feof
fn_proto: 'fn (__stream: *struct _IO_FILE) int'
name: ferror
fn_proto: 'fn (__stream: *struct _IO_FILE) void'
name: clearerr_unlocked
fn_proto: 'fn (__stream: *struct _IO_FILE) int'
name: feof_unlocked
fn_proto: 'fn (__stream: *struct _IO_FILE) int'
name: ferror_unlocked
fn_proto: 'fn (__s: *const char) void'
name: perror
fn_proto: 'fn (__stream: *struct _IO_FILE) int'
name: fileno
fn_proto: 'fn (__stream: *struct _IO_FILE) int'
name: fileno_unlocked
fn_proto: 'fn (__command: *const char, __modes: *const char) *struct _IO_FILE'
name: popen
fn_proto: 'fn (__stream: *struct _IO_FILE) int'
name: pclose
fn_proto: 'fn (__s: *char) *char'
name: ctermid
fn_proto: 'fn (__stream: *struct _IO_FILE) void'
name: flockfile
fn_proto: 'fn (__stream: *struct _IO_FILE) int'
name: ftrylockfile
fn_proto: 'fn (__stream: *struct _IO_FILE) void'
name: funlockfile
fn_proto: 'fn (*struct _IO_FILE) int'
name: __uflow
fn_proto: 'fn (*struct _IO_FILE, int) int'
name: __overflow
fn_def: 'fn (...) int'
name: main
body:
compound_stmt_two: 'void'
call_expr_one: 'int'
lhs:
function_to_pointer: '*fn (__format: restrict *const char, ...) int'
decl_ref_expr: 'fn (__format: restrict *const char, ...) int' lvalue
name: printf
arg:
array_to_pointer: 'd[11]char'
string_literal_expr: '[11]char' lvalue
data: "Well, heck"
return_stmt: 'void'
expr:
int_literal: 'int' (value: 0)
value: 0 I guess you're right, it just throws the AST at me Any way to get the output binary though? |
This is just a frontend - no code generation currently. I can't speak for Vexu but the stated goal from the README is that it becomes good enough that Zig's |
Thanks! Hope its usable enough to replace the use of clang in Zig soon enough 🙂 |
@Vexu This looks interesting! If so, any instructions? |
Ahh, right, in the README.md! This was pretty fast! |
where test.c reads
Built with Zig v0.9.0-dev.861+311797f68 via
zig build
The text was updated successfully, but these errors were encountered: