not finisshed
This commit is contained in:
parent
c2f6f97590
commit
6ae49ea4c8
45
.vscode/launch.json
vendored
Normal file
45
.vscode/launch.json
vendored
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
{
|
||||||
|
// Use IntelliSense to learn about possible attributes.
|
||||||
|
// Hover to view descriptions of existing attributes.
|
||||||
|
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"type": "lldb",
|
||||||
|
"request": "launch",
|
||||||
|
"name": "Debug executable 'mclangc-v2'",
|
||||||
|
"cargo": {
|
||||||
|
"args": [
|
||||||
|
"build",
|
||||||
|
"--bin=mclangc-v2",
|
||||||
|
"--package=mclangc-v2"
|
||||||
|
],
|
||||||
|
"filter": {
|
||||||
|
"name": "mclangc-v2",
|
||||||
|
"kind": "bin"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"args": ["-o", "test", "test.mcl", "-r"],
|
||||||
|
"cwd": "${workspaceFolder}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "lldb",
|
||||||
|
"request": "launch",
|
||||||
|
"name": "Debug unit tests in executable 'mclangc-v2'",
|
||||||
|
"cargo": {
|
||||||
|
"args": [
|
||||||
|
"test",
|
||||||
|
"--no-run",
|
||||||
|
"--bin=mclangc-v2",
|
||||||
|
"--package=mclangc-v2"
|
||||||
|
],
|
||||||
|
"filter": {
|
||||||
|
"name": "mclangc-v2",
|
||||||
|
"kind": "bin"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"args": [],
|
||||||
|
"cwd": "${workspaceFolder}"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -6,317 +6,317 @@ const STDERR 2 end
|
||||||
|
|
||||||
|
|
||||||
// syscalls
|
// syscalls
|
||||||
const SYS_read 0 end
|
// const SYS_read 0 end
|
||||||
const SYS_write 1 end
|
const SYS_write 1 end
|
||||||
const SYS_open 2 end
|
// const SYS_open 2 end
|
||||||
const SYS_close 3 end
|
// const SYS_close 3 end
|
||||||
const SYS_stat 4 end
|
// const SYS_stat 4 end
|
||||||
const SYS_fstat 5 end
|
// const SYS_fstat 5 end
|
||||||
const SYS_lstat 6 end
|
// const SYS_lstat 6 end
|
||||||
const SYS_poll 7 end
|
// const SYS_poll 7 end
|
||||||
const SYS_lseek 8 end
|
// const SYS_lseek 8 end
|
||||||
const SYS_mmap 9 end
|
// const SYS_mmap 9 end
|
||||||
const SYS_mprotect 10 end
|
// const SYS_mprotect 10 end
|
||||||
const SYS_munmap 11 end
|
// const SYS_munmap 11 end
|
||||||
const SYS_brk 12 end
|
// const SYS_brk 12 end
|
||||||
const SYS_rt_sigaction 13 end
|
// const SYS_rt_sigaction 13 end
|
||||||
const SYS_rt_sigprocmask 14 end
|
// const SYS_rt_sigprocmask 14 end
|
||||||
const SYS_rt_sigreturn 15 end
|
// const SYS_rt_sigreturn 15 end
|
||||||
const SYS_ioctl 16 end
|
// const SYS_ioctl 16 end
|
||||||
const SYS_pread64 17 end
|
// const SYS_pread64 17 end
|
||||||
const SYS_pwrite64 18 end
|
// const SYS_pwrite64 18 end
|
||||||
const SYS_readv 19 end
|
// const SYS_readv 19 end
|
||||||
const SYS_writev 20 end
|
// const SYS_writev 20 end
|
||||||
const SYS_access 21 end
|
// const SYS_access 21 end
|
||||||
const SYS_pipe 22 end
|
// const SYS_pipe 22 end
|
||||||
const SYS_select 23 end
|
// const SYS_select 23 end
|
||||||
const SYS_sched_yield 24 end
|
// const SYS_sched_yield 24 end
|
||||||
const SYS_mremap 25 end
|
// const SYS_mremap 25 end
|
||||||
const SYS_msync 26 end
|
// const SYS_msync 26 end
|
||||||
const SYS_mincore 27 end
|
// const SYS_mincore 27 end
|
||||||
const SYS_madvise 28 end
|
// const SYS_madvise 28 end
|
||||||
const SYS_shmget 29 end
|
// const SYS_shmget 29 end
|
||||||
const SYS_shmat 30 end
|
// const SYS_shmat 30 end
|
||||||
const SYS_shmctl 31 end
|
// const SYS_shmctl 31 end
|
||||||
const SYS_dup 32 end
|
// const SYS_dup 32 end
|
||||||
const SYS_dup2 33 end
|
// const SYS_dup2 33 end
|
||||||
const SYS_pause 34 end
|
// const SYS_pause 34 end
|
||||||
const SYS_nanosleep 35 end
|
// const SYS_nanosleep 35 end
|
||||||
const SYS_getitimer 36 end
|
// const SYS_getitimer 36 end
|
||||||
const SYS_alarm 37 end
|
// const SYS_alarm 37 end
|
||||||
const SYS_setitimer 38 end
|
// const SYS_setitimer 38 end
|
||||||
const SYS_getpid 39 end
|
// const SYS_getpid 39 end
|
||||||
const SYS_sendfile 40 end
|
// const SYS_sendfile 40 end
|
||||||
const SYS_socket 41 end
|
// const SYS_socket 41 end
|
||||||
const SYS_connect 42 end
|
// const SYS_connect 42 end
|
||||||
const SYS_accept 43 end
|
// const SYS_accept 43 end
|
||||||
const SYS_sendto 44 end
|
// const SYS_sendto 44 end
|
||||||
const SYS_recvfrom 45 end
|
// const SYS_recvfrom 45 end
|
||||||
const SYS_sendmsg 46 end
|
// const SYS_sendmsg 46 end
|
||||||
const SYS_recvmsg 47 end
|
// const SYS_recvmsg 47 end
|
||||||
const SYS_shutdown 48 end
|
// const SYS_shutdown 48 end
|
||||||
const SYS_bind 49 end
|
// const SYS_bind 49 end
|
||||||
const SYS_listen 50 end
|
// const SYS_listen 50 end
|
||||||
const SYS_getsockname 51 end
|
// const SYS_getsockname 51 end
|
||||||
const SYS_getpeername 52 end
|
// const SYS_getpeername 52 end
|
||||||
const SYS_socketpair 53 end
|
// const SYS_socketpair 53 end
|
||||||
const SYS_setsockopt 54 end
|
// const SYS_setsockopt 54 end
|
||||||
const SYS_getsockopt 55 end
|
// const SYS_getsockopt 55 end
|
||||||
const SYS_clone 56 end
|
// const SYS_clone 56 end
|
||||||
const SYS_fork 57 end
|
// const SYS_fork 57 end
|
||||||
const SYS_vfork 58 end
|
// const SYS_vfork 58 end
|
||||||
const SYS_execve 59 end
|
// const SYS_execve 59 end
|
||||||
const SYS_exit 60 end
|
const SYS_exit 60 end
|
||||||
const SYS_wait4 61 end
|
// const SYS_wait4 61 end
|
||||||
const SYS_kill 62 end
|
// const SYS_kill 62 end
|
||||||
const SYS_uname 63 end
|
// const SYS_uname 63 end
|
||||||
const SYS_semget 64 end
|
// const SYS_semget 64 end
|
||||||
const SYS_semop 65 end
|
// const SYS_semop 65 end
|
||||||
const SYS_semctl 66 end
|
// const SYS_semctl 66 end
|
||||||
const SYS_shmdt 67 end
|
// const SYS_shmdt 67 end
|
||||||
const SYS_msgget 68 end
|
// const SYS_msgget 68 end
|
||||||
const SYS_msgsnd 69 end
|
// const SYS_msgsnd 69 end
|
||||||
const SYS_msgrcv 70 end
|
// const SYS_msgrcv 70 end
|
||||||
const SYS_msgctl 71 end
|
// const SYS_msgctl 71 end
|
||||||
const SYS_fcntl 72 end
|
// const SYS_fcntl 72 end
|
||||||
const SYS_flock 73 end
|
// const SYS_flock 73 end
|
||||||
const SYS_fsync 74 end
|
// const SYS_fsync 74 end
|
||||||
const SYS_fdatasync 75 end
|
// const SYS_fdatasync 75 end
|
||||||
const SYS_truncate 76 end
|
// const SYS_truncate 76 end
|
||||||
const SYS_ftruncate 77 end
|
// const SYS_ftruncate 77 end
|
||||||
const SYS_getdents 78 end
|
// const SYS_getdents 78 end
|
||||||
const SYS_getcwd 79 end
|
// const SYS_getcwd 79 end
|
||||||
const SYS_chdir 80 end
|
// const SYS_chdir 80 end
|
||||||
const SYS_fchdir 81 end
|
// const SYS_fchdir 81 end
|
||||||
const SYS_rename 82 end
|
// const SYS_rename 82 end
|
||||||
const SYS_mkdir 83 end
|
// const SYS_mkdir 83 end
|
||||||
const SYS_rmdir 84 end
|
// const SYS_rmdir 84 end
|
||||||
const SYS_creat 85 end
|
// const SYS_creat 85 end
|
||||||
const SYS_link 86 end
|
// const SYS_link 86 end
|
||||||
const SYS_unlink 87 end
|
// const SYS_unlink 87 end
|
||||||
const SYS_symlink 88 end
|
// const SYS_symlink 88 end
|
||||||
const SYS_readlink 89 end
|
// const SYS_readlink 89 end
|
||||||
const SYS_chmod 90 end
|
// const SYS_chmod 90 end
|
||||||
const SYS_fchmod 91 end
|
// const SYS_fchmod 91 end
|
||||||
const SYS_chown 92 end
|
// const SYS_chown 92 end
|
||||||
const SYS_fchown 93 end
|
// const SYS_fchown 93 end
|
||||||
const SYS_lchown 94 end
|
// const SYS_lchown 94 end
|
||||||
const SYS_umask 95 end
|
// const SYS_umask 95 end
|
||||||
const SYS_gettimeofday 96 end
|
// const SYS_gettimeofday 96 end
|
||||||
const SYS_getrlimit 97 end
|
// const SYS_getrlimit 97 end
|
||||||
const SYS_getrusage 98 end
|
// const SYS_getrusage 98 end
|
||||||
const SYS_sysinfo 99 end
|
// const SYS_sysinfo 99 end
|
||||||
const SYS_times 100 end
|
// const SYS_times 100 end
|
||||||
const SYS_ptrace 101 end
|
// const SYS_ptrace 101 end
|
||||||
const SYS_getuid 102 end
|
// const SYS_getuid 102 end
|
||||||
const SYS_syslog 103 end
|
// const SYS_syslog 103 end
|
||||||
const SYS_getgid 104 end
|
// const SYS_getgid 104 end
|
||||||
const SYS_setuid 105 end
|
// const SYS_setuid 105 end
|
||||||
const SYS_setgid 106 end
|
// const SYS_setgid 106 end
|
||||||
const SYS_geteuid 107 end
|
// const SYS_geteuid 107 end
|
||||||
const SYS_getegid 108 end
|
// const SYS_getegid 108 end
|
||||||
const SYS_setpgid 109 end
|
// const SYS_setpgid 109 end
|
||||||
const SYS_getppid 110 end
|
// const SYS_getppid 110 end
|
||||||
const SYS_getpgrp 111 end
|
// const SYS_getpgrp 111 end
|
||||||
const SYS_setsid 112 end
|
// const SYS_setsid 112 end
|
||||||
const SYS_setreuid 113 end
|
// const SYS_setreuid 113 end
|
||||||
const SYS_setregid 114 end
|
// const SYS_setregid 114 end
|
||||||
const SYS_getgroups 115 end
|
// const SYS_getgroups 115 end
|
||||||
const SYS_setgroups 116 end
|
// const SYS_setgroups 116 end
|
||||||
const SYS_setresuid 117 end
|
// const SYS_setresuid 117 end
|
||||||
const SYS_getresuid 118 end
|
// const SYS_getresuid 118 end
|
||||||
const SYS_setresgid 119 end
|
// const SYS_setresgid 119 end
|
||||||
const SYS_getresgid 120 end
|
// const SYS_getresgid 120 end
|
||||||
const SYS_getpgid 121 end
|
// const SYS_getpgid 121 end
|
||||||
const SYS_setfsuid 122 end
|
// const SYS_setfsuid 122 end
|
||||||
const SYS_setfsgid 123 end
|
// const SYS_setfsgid 123 end
|
||||||
const SYS_getsid 124 end
|
// const SYS_getsid 124 end
|
||||||
const SYS_capget 125 end
|
// const SYS_capget 125 end
|
||||||
const SYS_capset 126 end
|
// const SYS_capset 126 end
|
||||||
const SYS_rt_sigpending 127 end
|
// const SYS_rt_sigpending 127 end
|
||||||
const SYS_rt_sigtimedwait 128 end
|
// const SYS_rt_sigtimedwait 128 end
|
||||||
const SYS_rt_sigqueueinfo 129 end
|
// const SYS_rt_sigqueueinfo 129 end
|
||||||
const SYS_rt_sigsuspend 130 end
|
// const SYS_rt_sigsuspend 130 end
|
||||||
const SYS_sigaltstack 131 end
|
// const SYS_sigaltstack 131 end
|
||||||
const SYS_utime 132 end
|
// const SYS_utime 132 end
|
||||||
const SYS_mknod 133 end
|
// const SYS_mknod 133 end
|
||||||
const SYS_uselib 134 end
|
// const SYS_uselib 134 end
|
||||||
const SYS_personality 135 end
|
// const SYS_personality 135 end
|
||||||
const SYS_ustat 136 end
|
// const SYS_ustat 136 end
|
||||||
const SYS_statfs 137 end
|
// const SYS_statfs 137 end
|
||||||
const SYS_fstatfs 138 end
|
// const SYS_fstatfs 138 end
|
||||||
const SYS_sysfs 139 end
|
// const SYS_sysfs 139 end
|
||||||
const SYS_getpriority 140 end
|
// const SYS_getpriority 140 end
|
||||||
const SYS_setpriority 141 end
|
// const SYS_setpriority 141 end
|
||||||
const SYS_sched_setparam 142 end
|
// const SYS_sched_setparam 142 end
|
||||||
const SYS_sched_getparam 143 end
|
// const SYS_sched_getparam 143 end
|
||||||
const SYS_sched_setscheduler 144 end
|
// const SYS_sched_setscheduler 144 end
|
||||||
const SYS_sched_getscheduler 145 end
|
// const SYS_sched_getscheduler 145 end
|
||||||
const SYS_sched_get_priority_max 146 end
|
// const SYS_sched_get_priority_max 146 end
|
||||||
const SYS_sched_get_priority_min 147 end
|
// const SYS_sched_get_priority_min 147 end
|
||||||
const SYS_sched_rr_get_interval 148 end
|
// const SYS_sched_rr_get_interval 148 end
|
||||||
const SYS_mlock 149 end
|
// const SYS_mlock 149 end
|
||||||
const SYS_munlock 150 end
|
// const SYS_munlock 150 end
|
||||||
const SYS_mlockall 151 end
|
// const SYS_mlockall 151 end
|
||||||
const SYS_munlockall 152 end
|
// const SYS_munlockall 152 end
|
||||||
const SYS_vhangup 153 end
|
// const SYS_vhangup 153 end
|
||||||
const SYS_modify_ldt 154 end
|
// const SYS_modify_ldt 154 end
|
||||||
const SYS_pivot_root 155 end
|
// const SYS_pivot_root 155 end
|
||||||
const SYS__sysctl 156 end
|
// const SYS__sysctl 156 end
|
||||||
const SYS_prctl 157 end
|
// const SYS_prctl 157 end
|
||||||
const SYS_arch_prctl 158 end
|
// const SYS_arch_prctl 158 end
|
||||||
const SYS_adjtimex 159 end
|
// const SYS_adjtimex 159 end
|
||||||
const SYS_setrlimit 160 end
|
// const SYS_setrlimit 160 end
|
||||||
const SYS_chroot 161 end
|
// const SYS_chroot 161 end
|
||||||
const SYS_sync 162 end
|
// const SYS_sync 162 end
|
||||||
const SYS_acct 163 end
|
// const SYS_acct 163 end
|
||||||
const SYS_settimeofday 164 end
|
// const SYS_settimeofday 164 end
|
||||||
const SYS_mount 165 end
|
// const SYS_mount 165 end
|
||||||
const SYS_umount2 166 end
|
// const SYS_umount2 166 end
|
||||||
const SYS_swapon 167 end
|
// const SYS_swapon 167 end
|
||||||
const SYS_swapoff 168 end
|
// const SYS_swapoff 168 end
|
||||||
const SYS_reboot 169 end
|
// const SYS_reboot 169 end
|
||||||
const SYS_sethostname 170 end
|
// const SYS_sethostname 170 end
|
||||||
const SYS_setdomainname 171 end
|
// const SYS_setdomainname 171 end
|
||||||
const SYS_iopl 172 end
|
// const SYS_iopl 172 end
|
||||||
const SYS_ioperm 173 end
|
// const SYS_ioperm 173 end
|
||||||
const SYS_create_module 174 end
|
// const SYS_create_module 174 end
|
||||||
const SYS_init_module 175 end
|
// const SYS_init_module 175 end
|
||||||
const SYS_delete_module 176 end
|
// const SYS_delete_module 176 end
|
||||||
const SYS_get_kernel_syms 177 end
|
// const SYS_get_kernel_syms 177 end
|
||||||
const SYS_query_module 178 end
|
// const SYS_query_module 178 end
|
||||||
const SYS_quotactl 179 end
|
// const SYS_quotactl 179 end
|
||||||
const SYS_nfsservctl 180 end
|
// const SYS_nfsservctl 180 end
|
||||||
const SYS_getpmsg 181 end
|
// const SYS_getpmsg 181 end
|
||||||
const SYS_putpmsg 182 end
|
// const SYS_putpmsg 182 end
|
||||||
const SYS_afs_syscall 183 end
|
// const SYS_afs_syscall 183 end
|
||||||
const SYS_tuxcall 184 end
|
// const SYS_tuxcall 184 end
|
||||||
const SYS_security 185 end
|
// const SYS_security 185 end
|
||||||
const SYS_gettid 186 end
|
// const SYS_gettid 186 end
|
||||||
const SYS_readahead 187 end
|
// const SYS_readahead 187 end
|
||||||
const SYS_setxattr 188 end
|
// const SYS_setxattr 188 end
|
||||||
const SYS_lsetxattr 189 end
|
// const SYS_lsetxattr 189 end
|
||||||
const SYS_fsetxattr 190 end
|
// const SYS_fsetxattr 190 end
|
||||||
const SYS_getxattr 191 end
|
// const SYS_getxattr 191 end
|
||||||
const SYS_lgetxattr 192 end
|
// const SYS_lgetxattr 192 end
|
||||||
const SYS_fgetxattr 193 end
|
// const SYS_fgetxattr 193 end
|
||||||
const SYS_listxattr 194 end
|
// const SYS_listxattr 194 end
|
||||||
const SYS_llistxattr 195 end
|
// const SYS_llistxattr 195 end
|
||||||
const SYS_flistxattr 196 end
|
// const SYS_flistxattr 196 end
|
||||||
const SYS_removexattr 197 end
|
// const SYS_removexattr 197 end
|
||||||
const SYS_lremovexattr 198 end
|
// const SYS_lremovexattr 198 end
|
||||||
const SYS_fremovexattr 199 end
|
// const SYS_fremovexattr 199 end
|
||||||
const SYS_tkill 200 end
|
// const SYS_tkill 200 end
|
||||||
const SYS_time 201 end
|
// const SYS_time 201 end
|
||||||
const SYS_futex 202 end
|
// const SYS_futex 202 end
|
||||||
const SYS_sched_setaffinity 203 end
|
// const SYS_sched_setaffinity 203 end
|
||||||
const SYS_sched_getaffinity 204 end
|
// const SYS_sched_getaffinity 204 end
|
||||||
const SYS_set_thread_area 205 end
|
// const SYS_set_thread_area 205 end
|
||||||
const SYS_io_setup 206 end
|
// const SYS_io_setup 206 end
|
||||||
const SYS_io_destroy 207 end
|
// const SYS_io_destroy 207 end
|
||||||
const SYS_io_getevents 208 end
|
// const SYS_io_getevents 208 end
|
||||||
const SYS_io_submit 209 end
|
// const SYS_io_submit 209 end
|
||||||
const SYS_io_cancel 210 end
|
// const SYS_io_cancel 210 end
|
||||||
const SYS_get_thread_area 211 end
|
// const SYS_get_thread_area 211 end
|
||||||
const SYS_lookup_dcookie 212 end
|
// const SYS_lookup_dcookie 212 end
|
||||||
const SYS_epoll_create 213 end
|
// const SYS_epoll_create 213 end
|
||||||
const SYS_epoll_ctl_old 214 end
|
// const SYS_epoll_ctl_old 214 end
|
||||||
const SYS_epoll_wait_old 215 end
|
// const SYS_epoll_wait_old 215 end
|
||||||
const SYS_remap_file_pages 216 end
|
// const SYS_remap_file_pages 216 end
|
||||||
const SYS_getdents64 217 end
|
// const SYS_getdents64 217 end
|
||||||
const SYS_set_tid_address 218 end
|
// const SYS_set_tid_address 218 end
|
||||||
const SYS_restart_syscall 219 end
|
// const SYS_restart_syscall 219 end
|
||||||
const SYS_semtimedop 220 end
|
// const SYS_semtimedop 220 end
|
||||||
const SYS_fadvise64 221 end
|
// const SYS_fadvise64 221 end
|
||||||
const SYS_timer_create 222 end
|
// const SYS_timer_create 222 end
|
||||||
const SYS_timer_settime 223 end
|
// const SYS_timer_settime 223 end
|
||||||
const SYS_timer_gettime 224 end
|
// const SYS_timer_gettime 224 end
|
||||||
const SYS_timer_getoverrun 225 end
|
// const SYS_timer_getoverrun 225 end
|
||||||
const SYS_timer_delete 226 end
|
// const SYS_timer_delete 226 end
|
||||||
const SYS_clock_settime 227 end
|
// const SYS_clock_settime 227 end
|
||||||
const SYS_clock_gettime 228 end
|
// const SYS_clock_gettime 228 end
|
||||||
const SYS_clock_getres 229 end
|
// const SYS_clock_getres 229 end
|
||||||
const SYS_clock_nanosleep 230 end
|
// const SYS_clock_nanosleep 230 end
|
||||||
const SYS_exit_group 231 end
|
// const SYS_exit_group 231 end
|
||||||
const SYS_epoll_wait 232 end
|
// const SYS_epoll_wait 232 end
|
||||||
const SYS_epoll_ctl 233 end
|
// const SYS_epoll_ctl 233 end
|
||||||
const SYS_tgkill 234 end
|
// const SYS_tgkill 234 end
|
||||||
const SYS_utimes 235 end
|
// const SYS_utimes 235 end
|
||||||
const SYS_vserver 236 end
|
// const SYS_vserver 236 end
|
||||||
const SYS_mbind 237 end
|
// const SYS_mbind 237 end
|
||||||
const SYS_set_mempolicy 238 end
|
// const SYS_set_mempolicy 238 end
|
||||||
const SYS_get_mempolicy 239 end
|
// const SYS_get_mempolicy 239 end
|
||||||
const SYS_mq_open 240 end
|
// const SYS_mq_open 240 end
|
||||||
const SYS_mq_unlink 241 end
|
// const SYS_mq_unlink 241 end
|
||||||
const SYS_mq_timedsend 242 end
|
// const SYS_mq_timedsend 242 end
|
||||||
const SYS_mq_timedreceive 243 end
|
// const SYS_mq_timedreceive 243 end
|
||||||
const SYS_mq_notify 244 end
|
// const SYS_mq_notify 244 end
|
||||||
const SYS_mq_getsetattr 245 end
|
// const SYS_mq_getsetattr 245 end
|
||||||
const SYS_kexec_load 246 end
|
// const SYS_kexec_load 246 end
|
||||||
const SYS_waitid 247 end
|
// const SYS_waitid 247 end
|
||||||
const SYS_add_key 248 end
|
// const SYS_add_key 248 end
|
||||||
const SYS_request_key 249 end
|
// const SYS_request_key 249 end
|
||||||
const SYS_keyctl 250 end
|
// const SYS_keyctl 250 end
|
||||||
const SYS_ioprio_set 251 end
|
// const SYS_ioprio_set 251 end
|
||||||
const SYS_ioprio_get 252 end
|
// const SYS_ioprio_get 252 end
|
||||||
const SYS_inotify_init 253 end
|
// const SYS_inotify_init 253 end
|
||||||
const SYS_inotify_add_watch 254 end
|
// const SYS_inotify_add_watch 254 end
|
||||||
const SYS_inotify_rm_watch 255 end
|
// const SYS_inotify_rm_watch 255 end
|
||||||
const SYS_migrate_pages 256 end
|
// const SYS_migrate_pages 256 end
|
||||||
const SYS_openat 257 end
|
// const SYS_openat 257 end
|
||||||
const SYS_mkdirat 258 end
|
// const SYS_mkdirat 258 end
|
||||||
const SYS_mknodat 259 end
|
// const SYS_mknodat 259 end
|
||||||
const SYS_fchownat 260 end
|
// const SYS_fchownat 260 end
|
||||||
const SYS_futimesat 261 end
|
// const SYS_futimesat 261 end
|
||||||
const SYS_newfstatat 262 end
|
// const SYS_newfstatat 262 end
|
||||||
const SYS_unlinkat 263 end
|
// const SYS_unlinkat 263 end
|
||||||
const SYS_renameat 264 end
|
// const SYS_renameat 264 end
|
||||||
const SYS_linkat 265 end
|
// const SYS_linkat 265 end
|
||||||
const SYS_symlinkat 266 end
|
// const SYS_symlinkat 266 end
|
||||||
const SYS_readlinkat 267 end
|
// const SYS_readlinkat 267 end
|
||||||
const SYS_fchmodat 268 end
|
// const SYS_fchmodat 268 end
|
||||||
const SYS_faccessat 269 end
|
// const SYS_faccessat 269 end
|
||||||
const SYS_pselect6 270 end
|
// const SYS_pselect6 270 end
|
||||||
const SYS_ppoll 271 end
|
// const SYS_ppoll 271 end
|
||||||
const SYS_unshare 272 end
|
// const SYS_unshare 272 end
|
||||||
const SYS_set_robust_list 273 end
|
// const SYS_set_robust_list 273 end
|
||||||
const SYS_get_robust_list 274 end
|
// const SYS_get_robust_list 274 end
|
||||||
const SYS_splice 275 end
|
// const SYS_splice 275 end
|
||||||
const SYS_tee 276 end
|
// const SYS_tee 276 end
|
||||||
const SYS_sync_file_range 277 end
|
// const SYS_sync_file_range 277 end
|
||||||
const SYS_vmsplice 278 end
|
// const SYS_vmsplice 278 end
|
||||||
const SYS_move_pages 279 end
|
// const SYS_move_pages 279 end
|
||||||
const SYS_utimensat 280 end
|
// const SYS_utimensat 280 end
|
||||||
const SYS_epoll_pwait 281 end
|
// const SYS_epoll_pwait 281 end
|
||||||
const SYS_signalfd 282 end
|
// const SYS_signalfd 282 end
|
||||||
const SYS_timerfd_create 283 end
|
// const SYS_timerfd_create 283 end
|
||||||
const SYS_eventfd 284 end
|
// const SYS_eventfd 284 end
|
||||||
const SYS_fallocate 285 end
|
// const SYS_fallocate 285 end
|
||||||
const SYS_timerfd_settime 286 end
|
// const SYS_timerfd_settime 286 end
|
||||||
const SYS_timerfd_gettime 287 end
|
// const SYS_timerfd_gettime 287 end
|
||||||
const SYS_accept4 288 end
|
// const SYS_accept4 288 end
|
||||||
const SYS_signalfd4 289 end
|
// const SYS_signalfd4 289 end
|
||||||
const SYS_eventfd2 290 end
|
// const SYS_eventfd2 290 end
|
||||||
const SYS_epoll_create1 291 end
|
// const SYS_epoll_create1 291 end
|
||||||
const SYS_dup3 292 end
|
// const SYS_dup3 292 end
|
||||||
const SYS_pipe2 293 end
|
// const SYS_pipe2 293 end
|
||||||
const SYS_inotify_init1 294 end
|
// const SYS_inotify_init1 294 end
|
||||||
const SYS_preadv 295 end
|
// const SYS_preadv 295 end
|
||||||
const SYS_pwritev 296 end
|
// const SYS_pwritev 296 end
|
||||||
const SYS_rt_tgsigqueueinfo 297 end
|
// const SYS_rt_tgsigqueueinfo 297 end
|
||||||
const SYS_perf_event_open 298 end
|
// const SYS_perf_event_open 298 end
|
||||||
const SYS_recvmmsg 299 end
|
// const SYS_recvmmsg 299 end
|
||||||
const SYS_fanotify_init 300 end
|
// const SYS_fanotify_init 300 end
|
||||||
const SYS_fanotify_mark 301 end
|
// const SYS_fanotify_mark 301 end
|
||||||
const SYS_prlimit64 302 end
|
// const SYS_prlimit64 302 end
|
||||||
const SYS_name_to_handle_at 303 end
|
// const SYS_name_to_handle_at 303 end
|
||||||
const SYS_open_by_handle_at 304 end
|
// const SYS_open_by_handle_at 304 end
|
||||||
const SYS_clock_adjtime 305 end
|
// const SYS_clock_adjtime 305 end
|
||||||
const SYS_syncfs 306 end
|
// const SYS_syncfs 306 end
|
||||||
const SYS_sendmmsg 307 end
|
// const SYS_sendmmsg 307 end
|
||||||
const SYS_setns 308 end
|
// const SYS_setns 308 end
|
||||||
const SYS_getcpu 309 end
|
// const SYS_getcpu 309 end
|
||||||
const SYS_process_vm_readv 310 end
|
// const SYS_process_vm_readv 310 end
|
||||||
const SYS_process_vm_writev 311 end
|
// const SYS_process_vm_writev 311 end
|
||||||
const SYS_kcmp 312 end
|
// const SYS_kcmp 312 end
|
||||||
const SYS_finit_module 313 end
|
// const SYS_finit_module 313 end
|
|
@ -6,7 +6,6 @@ use anyhow::bail;
|
||||||
use crate::{cli::{CliArgs, CompilationTarget}, types::ast::Program};
|
use crate::{cli::{CliArgs, CompilationTarget}, types::ast::Program};
|
||||||
use std::{collections::HashMap, fs::File, io::{BufWriter, Write}, path::{Path, PathBuf}, process::Command};
|
use std::{collections::HashMap, fs::File, io::{BufWriter, Write}, path::{Path, PathBuf}, process::Command};
|
||||||
|
|
||||||
use self::utils::run_cmd;
|
|
||||||
|
|
||||||
|
|
||||||
pub trait Compiler {
|
pub trait Compiler {
|
||||||
|
|
|
@ -14,6 +14,7 @@ use super::Compiler;
|
||||||
|
|
||||||
pub struct X86_64LinuxNasmCompiler {
|
pub struct X86_64LinuxNasmCompiler {
|
||||||
strings: Vec<String>,
|
strings: Vec<String>,
|
||||||
|
func_mem_i: Vec<usize>,
|
||||||
if_i: usize,
|
if_i: usize,
|
||||||
while_i: usize,
|
while_i: usize,
|
||||||
used_consts: Vec<String>
|
used_consts: Vec<String>
|
||||||
|
@ -354,8 +355,14 @@ impl X86_64LinuxNasmCompiler {
|
||||||
writeln!(fd, "; WHILE({id}) END")?;
|
writeln!(fd, "; WHILE({id}) END")?;
|
||||||
},
|
},
|
||||||
AstNode::Module(m) => self.handle_module(fd, prog, m)?,
|
AstNode::Module(m) => self.handle_module(fd, prog, m)?,
|
||||||
AstNode::Memory(_) => todo!(),
|
AstNode::Memory(m) => {
|
||||||
AstNode::MemUse(_) => todo!(),
|
if !m.statc {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
AstNode::MemUse(_) => {
|
||||||
|
|
||||||
|
},
|
||||||
AstNode::ConstUse(c) => {
|
AstNode::ConstUse(c) => {
|
||||||
self.used_consts.push(c.ident.clone());
|
self.used_consts.push(c.ident.clone());
|
||||||
writeln!(fd, " mov rax, qword [c_{}]", c.ident)?;
|
writeln!(fd, " mov rax, qword [c_{}]", c.ident)?;
|
||||||
|
|
|
@ -157,9 +157,11 @@ impl Lexer {
|
||||||
}
|
}
|
||||||
|
|
||||||
'/' if chars.get(idx + 1) == Some(&'/') => {
|
'/' if chars.get(idx + 1) == Some(&'/') => {
|
||||||
while chars.get(idx) != Some(&'\n') {
|
let mut c = chars.get(idx);
|
||||||
|
while c.is_some() && c != Some(&'\n') {
|
||||||
self.loc.inc_col();
|
self.loc.inc_col();
|
||||||
idx += 1;
|
idx += 1;
|
||||||
|
c = chars.get(idx);
|
||||||
}
|
}
|
||||||
self.loc.inc_line();
|
self.loc.inc_line();
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,9 +6,9 @@ use std::{collections::HashMap, path::Path};
|
||||||
|
|
||||||
use anyhow::{bail, Result};
|
use anyhow::{bail, Result};
|
||||||
|
|
||||||
use crate::{cli::CliArgs, lexer::Lexer, types::{ast::{AstNode, Block, ConstUse, Constant, FnCall, Function, If, MemUse, Module, Program, While}, common::Loc, token::{InstructionType, KeywordType, Token, TokenType}}};
|
use crate::{cli::CliArgs, lexer::Lexer, types::{ast::{AstNode, Block, ConstUse, Constant, FnCall, Function, If, MemUse, Memory, Module, Program, While}, common::Loc, token::{InstructionType, KeywordType, Token, TokenType}}};
|
||||||
|
|
||||||
use self::{builtin::get_builtin_symbols, precompiler::precompile, utils::{expect, peek_check, peek_check_multiple, PeekResult}};
|
use self::{builtin::get_builtin_symbols, precompiler::{precompile_const, precompile_mem}, utils::{expect, peek_check, peek_check_multiple, PeekResult}};
|
||||||
|
|
||||||
|
|
||||||
bitflags::bitflags! {
|
bitflags::bitflags! {
|
||||||
|
@ -69,8 +69,8 @@ fn parse_next(cli_args: &CliArgs, prog: &mut Program, tokens: &mut Vec<Token>, f
|
||||||
match kw {
|
match kw {
|
||||||
KeywordType::If => parse_if(&token, cli_args, prog, tokens)?,
|
KeywordType::If => parse_if(&token, cli_args, prog, tokens)?,
|
||||||
KeywordType::While => parse_while(&token, cli_args, prog, tokens)?,
|
KeywordType::While => parse_while(&token, cli_args, prog, tokens)?,
|
||||||
KeywordType::Include => parse_include(&token, cli_args, prog, tokens)?, //TODO: implement include
|
KeywordType::Include => parse_include(&token, cli_args, prog, tokens)?,
|
||||||
KeywordType::Memory => todo!(),
|
KeywordType::Memory => parse_memory(&token, cli_args, prog, tokens, is_module_root)?,
|
||||||
KeywordType::Constant => parse_const(&token, cli_args, prog, tokens)?,
|
KeywordType::Constant => parse_const(&token, cli_args, prog, tokens)?,
|
||||||
KeywordType::Function => parse_function(&token, cli_args, prog, tokens, flags)?,
|
KeywordType::Function => parse_function(&token, cli_args, prog, tokens, flags)?,
|
||||||
KeywordType::Struct => todo!(),
|
KeywordType::Struct => todo!(),
|
||||||
|
@ -105,6 +105,43 @@ fn parse_next(cli_args: &CliArgs, prog: &mut Program, tokens: &mut Vec<Token>, f
|
||||||
Ok(ret)
|
Ok(ret)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn parse_memory(org: &Token, cli_args: &CliArgs, prog: &mut Program, tokens: &mut Vec<Token>, is_module_root: bool) -> Result<AstNode> {
|
||||||
|
let name = expect(tokens, TokenType::Unknown(String::new()))?;
|
||||||
|
|
||||||
|
|
||||||
|
let mut body = Vec::new();
|
||||||
|
loop {
|
||||||
|
|
||||||
|
let t = peek_check(tokens, TokenType::Keyword(KeywordType::End));
|
||||||
|
match t {
|
||||||
|
PeekResult::Correct(_) => break,
|
||||||
|
PeekResult::Wrong(_) => (),
|
||||||
|
PeekResult::None => panic!("idk what to do herre"),
|
||||||
|
}
|
||||||
|
body.push(parse_next(cli_args, prog, tokens, Flags::empty(), false)?);
|
||||||
|
}
|
||||||
|
expect(tokens, TokenType::Keyword(KeywordType::End))?;
|
||||||
|
|
||||||
|
let val = precompile_mem(prog, body)?;
|
||||||
|
|
||||||
|
let name = name.lexem.clone()
|
||||||
|
.replace("(", "_OPRN_")
|
||||||
|
.replace(")", "_CPRN_");
|
||||||
|
|
||||||
|
let def = Memory{
|
||||||
|
loc: org.loc(),
|
||||||
|
ident: name.clone(),
|
||||||
|
size: val,
|
||||||
|
statc: is_module_root,
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
prog.memories.insert(name, def.clone());
|
||||||
|
|
||||||
|
Ok(AstNode::Memory(def))
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: Extern functions
|
// TODO: Extern functions
|
||||||
fn parse_function(org: &Token, cli_args: &CliArgs, prog: &mut Program, tokens: &mut Vec<Token>, flags: Flags ) -> Result<AstNode> {
|
fn parse_function(org: &Token, cli_args: &CliArgs, prog: &mut Program, tokens: &mut Vec<Token>, flags: Flags ) -> Result<AstNode> {
|
||||||
|
|
||||||
|
@ -509,20 +546,17 @@ fn parse_const(org: &Token, cli_args: &CliArgs, prog: &mut Program, tokens: &mut
|
||||||
}
|
}
|
||||||
expect(tokens, TokenType::Keyword(KeywordType::End))?;
|
expect(tokens, TokenType::Keyword(KeywordType::End))?;
|
||||||
|
|
||||||
let val = precompile(prog, body, &mut Vec::new())?;
|
let val = precompile_const(prog, body, &mut Vec::new())?;
|
||||||
|
|
||||||
let name = name.lexem.clone()
|
|
||||||
.replace("(", "_OPRN_")
|
|
||||||
.replace(")", "_CPRN_");
|
|
||||||
|
|
||||||
let def = Constant{
|
let def = Constant{
|
||||||
loc: org.loc(),
|
loc: org.loc(),
|
||||||
ident: name.clone(),
|
ident: name.lexem.clone(),
|
||||||
value: Box::new(val),
|
value: Box::new(val),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
prog.constants.insert(name, def.clone());
|
prog.constants.insert(name.lexem, def.clone());
|
||||||
|
|
||||||
Ok(AstNode::Constant(def))
|
Ok(AstNode::Constant(def))
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,23 @@ use anyhow::bail;
|
||||||
use crate::types::{ast::{AstNode, Program}, common::Loc, token::{InstructionType, TokenType}};
|
use crate::types::{ast::{AstNode, Program}, common::Loc, token::{InstructionType, TokenType}};
|
||||||
|
|
||||||
|
|
||||||
pub fn precompile(prog: &Program, ast: Vec<AstNode>, stack: &mut Vec<usize> ) -> anyhow::Result<AstNode> {
|
pub fn precompile_mem(prog: &Program, ast: Vec<AstNode> ) -> anyhow::Result<usize> {
|
||||||
|
match precompile_const(prog, ast, &mut Vec::new()) {
|
||||||
|
Ok(v) => {
|
||||||
|
match v {
|
||||||
|
AstNode::Int(_, i) => {
|
||||||
|
return Ok(i)
|
||||||
|
}
|
||||||
|
_ => {
|
||||||
|
error!("memories can only have numbers or types in their size");
|
||||||
|
bail!("")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Err(e) => bail!(e),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pub fn precompile_const(prog: &Program, ast: Vec<AstNode>, stack: &mut Vec<usize> ) -> anyhow::Result<AstNode> {
|
||||||
for node in ast.clone() {
|
for node in ast.clone() {
|
||||||
match &node {
|
match &node {
|
||||||
AstNode::ConstUse(c) => {
|
AstNode::ConstUse(c) => {
|
||||||
|
|
|
@ -135,6 +135,7 @@ pub struct Constant {
|
||||||
pub struct Memory {
|
pub struct Memory {
|
||||||
pub loc: Loc,
|
pub loc: Loc,
|
||||||
pub ident: String,
|
pub ident: String,
|
||||||
|
pub statc: bool,
|
||||||
pub size: usize // bytes
|
pub size: usize // bytes
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,4 +146,28 @@ pub struct Program {
|
||||||
pub functions: HashMap<String, Function>,
|
pub functions: HashMap<String, Function>,
|
||||||
pub constants: HashMap<String, Constant>,
|
pub constants: HashMap<String, Constant>,
|
||||||
pub memories: HashMap<String, Memory>,
|
pub memories: HashMap<String, Memory>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl EscIdent for Constant {
|
||||||
|
fn ident(&self) -> String {
|
||||||
|
self.ident.clone()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl EscIdent for Memory {
|
||||||
|
fn ident(&self) -> String {
|
||||||
|
self.ident.clone()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl EscIdent for Function {
|
||||||
|
fn ident(&self) -> String {
|
||||||
|
self.ident.clone()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub trait EscIdent {
|
||||||
|
fn ident(&self) -> String;
|
||||||
|
fn get_ident_escaped(&self) -> String {
|
||||||
|
self.ident().replace("(", "_OPRN_")
|
||||||
|
.replace(")", "_CPRN_")
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user