started working on other repos

This commit is contained in:
MCorange 2023-04-13 13:38:20 +03:00
parent 8f43e042f0
commit 5e2ffcdfda
18 changed files with 9 additions and 2622 deletions

View File

@ -1,318 +0,0 @@
# linux syscalls
|%rax | Name | Entry point | Implementation |
|-----|------------------------|-------------------------------|------------------------------------|
| 0 | read | sys_read | fs/read_write.c |
| 1 | write | sys_write | fs/read_write.c |
| 2 | open | sys_open | fs/open.c |
| 3 | close | sys_close | fs/open.c |
| 4 | stat | sys_newstat | fs/stat.c |
| 5 | fstat | sys_newfstat | fs/stat.c |
| 6 | lstat | sys_newlstat | fs/stat.c |
| 7 | poll | sys_poll | fs/select.c |
| 8 | lseek | sys_lseek | fs/read_write.c |
| 9 | mmap | sys_mmap | arch/x86/kernel/sys_x86_64.c |
| 10 | mprotect | sys_mprotect | mm/mprotect.c |
| 11 | munmap | sys_munmap | mm/mmap.c |
| 12 | brk | sys_brk | mm/mmap.c |
| 13 | rt_sigaction | sys_rt_sigaction | kernel/signal.c |
| 14 | rt_sigprocmask | sys_rt_sigprocmask | kernel/signal.c |
| 15 | rt_sigreturn | stub_rt_sigreturn | arch/x86/kernel/signal.c |
| 16 | ioctl | sys_ioctl | fs/ioctl.c |
| 17 | pread64 | sys_pread64 | fs/read_write.c |
| 18 | pwrite64 | sys_pwrite64 | fs/read_write.c |
| 19 | readv | sys_readv | fs/read_write.c |
| 20 | writev | sys_writev | fs/read_write.c |
| 21 | access | sys_access | fs/open.c |
| 22 | pipe | sys_pipe | fs/pipe.c |
| 23 | select | sys_select | fs/select.c |
| 24 | sched_yield | sys_sched_yield | kernel/sched/core.c |
| 25 | mremap | sys_mremap | mm/mmap.c |
| 26 | msync | sys_msync | mm/msync.c |
| 27 | mincore | sys_mincore | mm/mincore.c |
| 28 | madvise | sys_madvise | mm/madvise.c |
| 29 | shmget | sys_shmget | ipc/shm.c |
| 30 | shmat | sys_shmat | ipc/shm.c |
| 31 | shmctl | sys_shmctl | ipc/shm.c |
| 32 | dup | sys_dup | fs/file.c |
| 33 | dup2 | sys_dup2 | fs/file.c |
| 34 | pause | sys_pause | kernel/signal.c |
| 35 | nanosleep | sys_nanosleep | kernel/hrtimer.c |
| 36 | getitimer | sys_getitimer | kernel/itimer.c |
| 37 | alarm | sys_alarm | kernel/timer.c |
| 38 | setitimer | sys_setitimer | kernel/itimer.c |
| 39 | getpid | sys_getpid | kernel/sys.c |
| 40 | sendfile | sys_sendfile64 | fs/read_write.c |
| 41 | socket | sys_socket | net/socket.c |
| 42 | connect | sys_connect | net/socket.c |
| 43 | accept | sys_accept | net/socket.c |
| 44 | sendto | sys_sendto | net/socket.c |
| 45 | recvfrom | sys_recvfrom | net/socket.c |
| 46 | sendmsg | sys_sendmsg | net/socket.c |
| 47 | recvmsg | sys_recvmsg | net/socket.c |
| 48 | shutdown | sys_shutdown | net/socket.c |
| 49 | bind | sys_bind | net/socket.c |
| 50 | listen | sys_listen | net/socket.c |
| 51 | getsockname | sys_getsockname | net/socket.c |
| 52 | getpeername | sys_getpeername | net/socket.c |
| 53 | socketpair | sys_socketpair | net/socket.c |
| 54 | setsockopt | sys_setsockopt | net/socket.c |
| 55 | getsockopt | sys_getsockopt | net/socket.c |
| 56 | clone | stub_clone | kernel/fork.c |
| 57 | fork | stub_fork | kernel/fork.c |
| 58 | vfork | stub_vfork | kernel/fork.c |
| 59 | execve | stub_execve | fs/exec.c |
| 60 | exit | sys_exit | kernel/exit.c |
| 61 | wait4 | sys_wait4 | kernel/exit.c |
| 62 | kill | sys_kill | kernel/signal.c |
| 63 | uname | sys_newuname | kernel/sys.c |
| 64 | semget | sys_semget | ipc/sem.c |
| 65 | semop | sys_semop | ipc/sem.c |
| 66 | semctl | sys_semctl | ipc/sem.c |
| 67 | shmdt | sys_shmdt | ipc/shm.c |
| 68 | msgget | sys_msgget | ipc/msg.c |
| 69 | msgsnd | sys_msgsnd | ipc/msg.c |
| 70 | msgrcv | sys_msgrcv | ipc/msg.c |
| 71 | msgctl | sys_msgctl | ipc/msg.c |
| 72 | fcntl | sys_fcntl | fs/fcntl.c |
| 73 | flock | sys_flock | fs/locks.c |
| 74 | fsync | sys_fsync | fs/sync.c |
| 75 | fdatasync | sys_fdatasync | fs/sync.c |
| 76 | truncate | sys_truncate | fs/open.c |
| 77 | ftruncate | sys_ftruncate | fs/open.c |
| 78 | getdents | sys_getdents | fs/readdir.c |
| 79 | getcwd | sys_getcwd | fs/dcache.c |
| 80 | chdir | sys_chdir | fs/open.c |
| 81 | fchdir | sys_fchdir | fs/open.c |
| 82 | rename | sys_rename | fs/namei.c |
| 83 | mkdir | sys_mkdir | fs/namei.c |
| 84 | rmdir | sys_rmdir | fs/namei.c |
| 85 | creat | sys_creat | fs/open.c |
| 86 | link | sys_link | fs/namei.c |
| 87 | unlink | sys_unlink | fs/namei.c |
| 88 | symlink | sys_symlink | fs/namei.c |
| 89 | readlink | sys_readlink | fs/stat.c |
| 90 | chmod | sys_chmod | fs/open.c |
| 91 | fchmod | sys_fchmod | fs/open.c |
| 92 | chown | sys_chown | fs/open.c |
| 93 | fchown | sys_fchown | fs/open.c |
| 94 | lchown | sys_lchown | fs/open.c |
| 95 | umask | sys_umask | kernel/sys.c |
| 96 | gettimeofday | sys_gettimeofday | kernel/time.c |
| 97 | getrlimit | sys_getrlimit | kernel/sys.c |
| 98 | getrusage | sys_getrusage | kernel/sys.c |
| 99 | sysinfo | sys_sysinfo | kernel/sys.c |
| 100 | times | sys_times | kernel/sys.c |
| 101 | ptrace | sys_ptrace | kernel/ptrace.c |
| 102 | getuid | sys_getuid | kernel/sys.c |
| 103 | syslog | sys_syslog | kernel/printk/printk.c |
| 104 | getgid | sys_getgid | kernel/sys.c |
| 105 | setuid | sys_setuid | kernel/sys.c |
| 106 | setgid | sys_setgid | kernel/sys.c |
| 107 | geteuid | sys_geteuid | kernel/sys.c |
| 108 | getegid | sys_getegid | kernel/sys.c |
| 109 | setpgid | sys_setpgid | kernel/sys.c |
| 110 | getppid | sys_getppid | kernel/sys.c |
| 111 | getpgrp | sys_getpgrp | kernel/sys.c |
| 112 | setsid | sys_setsid | kernel/sys.c |
| 113 | setreuid | sys_setreuid | kernel/sys.c |
| 114 | setregid | sys_setregid | kernel/sys.c |
| 115 | getgroups | sys_getgroups | kernel/groups.c |
| 116 | setgroups | sys_setgroups | kernel/groups.c |
| 117 | setresuid | sys_setresuid | kernel/sys.c |
| 118 | getresuid | sys_getresuid | kernel/sys.c |
| 119 | setresgid | sys_setresgid | kernel/sys.c |
| 120 | getresgid | sys_getresgid | kernel/sys.c |
| 121 | getpgid | sys_getpgid | kernel/sys.c |
| 122 | setfsuid | sys_setfsuid | kernel/sys.c |
| 123 | setfsgid | sys_setfsgid | kernel/sys.c |
| 124 | getsid | sys_getsid | kernel/sys.c |
| 125 | capget | sys_capget | kernel/capability.c |
| 126 | capset | sys_capset | kernel/capability.c |
| 127 | rt_sigpending | sys_rt_sigpending | kernel/signal.c |
| 128 | rt_sigtimedwait | sys_rt_sigtimedwait | kernel/signal.c |
| 129 | rt_sigqueueinfo | sys_rt_sigqueueinfo | kernel/signal.c |
| 130 | rt_sigsuspend | sys_rt_sigsuspend | kernel/signal.c |
| 131 | sigaltstack | sys_sigaltstack | kernel/signal.c |
| 132 | utime | sys_utime | fs/utimes.c |
| 133 | mknod | sys_mknod | fs/namei.c |
| 134 | uselib | NONE_NONE | fs/exec.c |
| 135 | personality | sys_personality | kernel/exec_domain.c |
| 136 | ustat | sys_ustat | fs/statfs.c |
| 137 | statfs | sys_statfs | fs/statfs.c |
| 138 | fstatfs | sys_fstatfs | fs/statfs.c |
| 139 | sysfs | sys_sysfs | fs/filesystems.c |
| 140 | getpriority | sys_getpriority | kernel/sys.c |
| 141 | setpriority | sys_setpriority | kernel/sys.c |
| 142 | sched_setparam | sys_sched_setparam | kernel/sched/core.c |
| 143 | sched_getparam | sys_sched_getparam | kernel/sched/core.c |
| 144 | sched_setscheduler | sys_sched_setscheduler | kernel/sched/core.c |
| 145 | sched_getscheduler | sys_sched_getscheduler | kernel/sched/core.c |
| 146 | sched_get_priority_max | sys_sched_get_priority_max | kernel/sched/core.c |
| 147 | sched_get_priority_min | sys_sched_get_priority_min | kernel/sched/core.c |
| 148 | sched_rr_get_interval | sys_sched_rr_get_interval | kernel/sched/core.c |
| 149 | mlock | sys_mlock | mm/mlock.c |
| 150 | munlock | sys_munlock | mm/mlock.c |
| 151 | mlockall | sys_mlockall | mm/mlock.c |
| 152 | munlockall | sys_munlockall | mm/mlock.c |
| 153 | vhangup | sys_vhangup | fs/open.c |
| 154 | modify_ldt | sys_modify_ldt | arch/x86/um/ldt.c |
| 155 | pivot_root | sys_pivot_root | fs/namespace.c |
| 156 | _sysctl | sys_sysctl | kernel/sysctl_binary.c |
| 157 | prctl | sys_prctl | kernel/sys.c |
| 158 | arch_prctl | sys_arch_prctl | arch/x86/um/syscalls_64.c |
| 159 | adjtimex | sys_adjtimex | kernel/time.c |
| 160 | setrlimit | sys_setrlimit | kernel/sys.c |
| 161 | chroot | sys_chroot | fs/open.c |
| 162 | sync | sys_sync | fs/sync.c |
| 163 | acct | sys_acct | kernel/acct.c |
| 164 | settimeofday | sys_settimeofday | kernel/time.c |
| 165 | mount | sys_mount | fs/namespace.c |
| 166 | umount2 | sys_umount | fs/namespace.c |
| 167 | swapon | sys_swapon | mm/swapfile.c |
| 168 | swapoff | sys_swapoff | mm/swapfile.c |
| 169 | reboot | sys_reboot | kernel/reboot.c |
| 170 | sethostname | sys_sethostname | kernel/sys.c |
| 171 | setdomainname | sys_setdomainname | kernel/sys.c |
| 172 | iopl | stub_iopl | arch/x86/kernel/ioport.c |
| 173 | ioperm | sys_ioperm | arch/x86/kernel/ioport.c |
| 174 | create_module | NONE_NONE | NOT_IMPLEMENTED |
| 175 | init_module | sys_init_module | kernel/module.c |
| 176 | delete_module | sys_delete_module | kernel/module.c |
| 177 | get_kernel_syms | NONE_NONE | NOT_IMPLEMENTED |
| 178 | query_module | NONE_NONE | NOT_IMPLEMENTED |
| 179 | quotactl | sys_quotactl | fs/quota/quota.c |
| 180 | nfsservctl | NONE_NONE | NOT_IMPLEMENTED |
| 181 | getpmsg | NONE_NONE | NOT_IMPLEMENTED |
| 182 | putpmsg | NONE_NONE | NOT_IMPLEMENTED |
| 183 | afs_syscall | NONE_NONE | NOT_IMPLEMENTED |
| 184 | tuxcall | NONE_NONE | NOT_IMPLEMENTED |
| 185 | security | NONE_NONE | NOT_IMPLEMENTED |
| 186 | gettid | sys_gettid | kernel/sys.c |
| 187 | readahead | sys_readahead | mm/readahead.c |
| 188 | setxattr | sys_setxattr | fs/xattr.c |
| 189 | lsetxattr | sys_lsetxattr | fs/xattr.c |
| 190 | fsetxattr | sys_fsetxattr | fs/xattr.c |
| 191 | getxattr | sys_getxattr | fs/xattr.c |
| 192 | lgetxattr | sys_lgetxattr | fs/xattr.c |
| 193 | fgetxattr | sys_fgetxattr | fs/xattr.c |
| 194 | listxattr | sys_listxattr | fs/xattr.c |
| 195 | llistxattr | sys_llistxattr | fs/xattr.c |
| 196 | flistxattr | sys_flistxattr | fs/xattr.c |
| 197 | removexattr | sys_removexattr | fs/xattr.c |
| 198 | lremovexattr | sys_lremovexattr | fs/xattr.c |
| 199 | fremovexattr | sys_fremovexattr | fs/xattr.c |
| 200 | tkill | sys_tkill | kernel/signal.c |
| 201 | time | sys_time | kernel/time.c |
| 202 | futex | sys_futex | kernel/futex.c |
| 203 | sched_setaffinity | sys_sched_setaffinity | kernel/sched/core.c |
| 204 | sched_getaffinity | sys_sched_getaffinity | kernel/sched/core.c |
| 205 | set_thread_area | NONE_NONE | arch/x86/kernel/tls.c |
| 206 | io_setup | sys_io_setup | fs/aio.c |
| 207 | io_destroy | sys_io_destroy | fs/aio.c |
| 208 | io_getevents | sys_io_getevents | fs/aio.c |
| 209 | io_submit | sys_io_submit | fs/aio.c |
| 210 | io_cancel | sys_io_cancel | fs/aio.c |
| 211 | get_thread_area | NONE_NONE | arch/x86/kernel/tls.c |
| 212 | lookup_dcookie | sys_lookup_dcookie | fs/dcookies.c |
| 213 | epoll_create | sys_epoll_create | fs/eventpoll.c |
| 214 | epoll_ctl_old | NONE_NONE | NOT_IMPLEMENTED |
| 215 | epoll_wait_old | NONE_NONE | NOT_IMPLEMENTED |
| 216 | remap_file_pages | sys_remap_file_pages | mm/fremap.c |
| 217 | getdents64 | sys_getdents64 | fs/readdir.c |
| 218 | set_tid_address | sys_set_tid_address | kernel/fork.c |
| 219 | restart_syscall | sys_restart_syscall | kernel/signal.c |
| 220 | semtimedop | sys_semtimedop | ipc/sem.c |
| 221 | fadvise64 | sys_fadvise64 | mm/fadvise.c |
| 222 | timer_create | sys_timer_create | kernel/posix-timers.c |
| 223 | timer_settime | sys_timer_settime | kernel/posix-timers.c |
| 224 | timer_gettime | sys_timer_gettime | kernel/posix-timers.c |
| 225 | timer_getoverrun | sys_timer_getoverrun | kernel/posix-timers.c |
| 226 | timer_delete | sys_timer_delete | kernel/posix-timers.c |
| 227 | clock_settime | sys_clock_settime | kernel/posix-timers.c |
| 228 | clock_gettime | sys_clock_gettime | kernel/posix-timers.c |
| 229 | clock_getres | sys_clock_getres | kernel/posix-timers.c |
| 230 | clock_nanosleep | sys_clock_nanosleep | kernel/posix-timers.c |
| 231 | exit_group | sys_exit_group | kernel/exit.c |
| 232 | epoll_wait | sys_epoll_wait | fs/eventpoll.c |
| 233 | epoll_ctl | sys_epoll_ctl | fs/eventpoll.c |
| 234 | tgkill | sys_tgkill | kernel/signal.c |
| 235 | utimes | sys_utimes | fs/utimes.c |
| 236 | vserver | NONE_NONE | NOT_IMPLEMENTED |
| 237 | mbind | sys_mbind | mm/mempolicy.c |
| 238 | set_mempolicy | sys_set_mempolicy | mm/mempolicy.c |
| 239 | get_mempolicy | sys_get_mempolicy | mm/mempolicy.c |
| 240 | mq_open | sys_mq_open | ipc/mqueue.c |
| 241 | mq_unlink | sys_mq_unlink | ipc/mqueue.c |
| 242 | mq_timedsend | sys_mq_timedsend | ipc/mqueue.c |
| 243 | mq_timedreceive | sys_mq_timedreceive | ipc/mqueue.c |
| 244 | mq_notify | sys_mq_notify | ipc/mqueue.c |
| 245 | mq_getsetattr | sys_mq_getsetattr | ipc/mqueue.c |
| 246 | kexec_load | sys_kexec_load | kernel/kexec.c |
| 247 | waitid | sys_waitid | kernel/exit.c |
| 248 | add_key | sys_add_key | security/keys/keyctl.c |
| 249 | request_key | sys_request_key | security/keys/keyctl.c |
| 250 | keyctl | sys_keyctl | security/keys/keyctl.c |
| 251 | ioprio_set | sys_ioprio_set | fs/ioprio.c |
| 252 | ioprio_get | sys_ioprio_get | fs/ioprio.c |
| 253 | inotify_init | sys_inotify_init | fs/notify/inotify/inotify_user.c |
| 254 | inotify_add_watch | sys_inotify_add_watch | fs/notify/inotify/inotify_user.c |
| 255 | inotify_rm_watch | sys_inotify_rm_watch | fs/notify/inotify/inotify_user.c |
| 256 | migrate_pages | sys_migrate_pages | mm/mempolicy.c |
| 257 | openat | sys_openat | fs/open.c |
| 258 | mkdirat | sys_mkdirat | fs/namei.c |
| 259 | mknodat | sys_mknodat | fs/namei.c |
| 260 | fchownat | sys_fchownat | fs/open.c |
| 261 | futimesat | sys_futimesat | fs/utimes.c |
| 262 | newfstatat | sys_newfstatat | fs/stat.c |
| 263 | unlinkat | sys_unlinkat | fs/namei.c |
| 264 | renameat | sys_renameat | fs/namei.c |
| 265 | linkat | sys_linkat | fs/namei.c |
| 266 | symlinkat | sys_symlinkat | fs/namei.c |
| 267 | readlinkat | sys_readlinkat | fs/stat.c |
| 268 | fchmodat | sys_fchmodat | fs/open.c |
| 269 | faccessat | sys_faccessat | fs/open.c |
| 270 | pselect6 | sys_pselect6 | fs/select.c |
| 271 | ppoll | sys_ppoll | fs/select.c |
| 272 | unshare | sys_unshare | kernel/fork.c |
| 273 | set_robust_list | sys_set_robust_list | kernel/futex.c |
| 274 | get_robust_list | sys_get_robust_list | kernel/futex.c |
| 275 | splice | sys_splice | fs/splice.c |
| 276 | tee | sys_tee | fs/splice.c |
| 277 | sync_file_range | sys_sync_file_range | fs/sync.c |
| 278 | vmsplice | sys_vmsplice | fs/splice.c |
| 279 | move_pages | sys_move_pages | mm/migrate.c |
| 280 | utimensat | sys_utimensat | fs/utimes.c |
| 281 | epoll_pwait | sys_epoll_pwait | fs/eventpoll.c |
| 282 | signalfd | sys_signalfd | fs/signalfd.c |
| 283 | timerfd_create | sys_timerfd_create | fs/timerfd.c |
| 284 | eventfd | sys_eventfd | fs/eventfd.c |
| 285 | fallocate | sys_fallocate | fs/open.c |
| 286 | timerfd_settime | sys_timerfd_settime | fs/timerfd.c |
| 287 | timerfd_gettime | sys_timerfd_gettime | fs/timerfd.c |
| 288 | accept4 | sys_accept4 | net/socket.c |
| 289 | signalfd4 | sys_signalfd4 | fs/signalfd.c |
| 290 | eventfd2 | sys_eventfd2 | fs/eventfd.c |
| 291 | epoll_create1 | sys_epoll_create1 | fs/eventpoll.c |
| 292 | dup3 | sys_dup3 | fs/file.c |
| 293 | pipe2 | sys_pipe2 | fs/pipe.c |
| 294 | inotify_init1 | sys_inotify_init1 | fs/notify/inotify/inotify_user.c |
| 295 | preadv | sys_preadv | fs/read_write.c |
| 296 | pwritev | sys_pwritev | fs/read_write.c |
| 297 | rt_tgsigqueueinfo | sys_rt_tgsigqueueinfo | kernel/signal.c |
| 298 | perf_event_open | sys_perf_event_open | kernel/events/core.c |
| 299 | recvmmsg | sys_recvmmsg | net/socket.c |
| 300 | fanotify_init | sys_fanotify_init | fs/notify/fanotify/fanotify_user.c |
| 301 | fanotify_mark | sys_fanotify_mark | fs/notify/fanotify/fanotify_user.c |
| 302 | prlimit64 | sys_prlimit64 | kernel/sys.c |
| 303 | name_to_handle_at | sys_name_to_handle_at | fs/fhandle.c |
| 304 | open_by_handle_at | sys_open_by_handle_at | fs/fhandle.c |
| 305 | clock_adjtime | sys_clock_adjtime | kernel/posix-timers.c |
| 306 | syncfs | sys_syncfs | fs/sync.c |
| 307 | sendmmsg | sys_sendmmsg | net/socket.c |
| 308 | setns | sys_setns | kernel/nsproxy.c |
| 309 | getcpu | sys_getcpu | kernel/sys.c |
| 310 | process_vm_readv | sys_process_vm_readv | mm/process_vm_access.c |
| 311 | process_vm_writev | sys_process_vm_writev | mm/process_vm_access.c |
| 312 | kcmp | sys_kcmp | kernel/kcmp.c |
| 313 | finit_module | sys_finit_module | kernel/module.c |

Binary file not shown.

View File

@ -1,2 +0,0 @@
# Docs

View File

@ -1,212 +0,0 @@
# Instructions And Keywords
This explains all of the instructions and keywords
## Instructions
Instructions modify the stack, the stack is an array, i will be using typescript to show how each instruction works
```ts
let stack: number[] = [];
```
### PushInt ("Any Number")
PushInt pushes one number on the stack.
Usage:
```forth
420
```
How it works:
```ts
// num = 420
stack.push(num);
console.assert(stack == [420]);
```
### PushStr ("Any String")
PushStr pushes 2 things on the stack, string length and string pointer
Usage:
```forth
"Henlo world!\n"
```
How it works:
```ts
stack.push(str_len);
stack.push(str_ptr);
```
### Print ("print")
Print just prints a number from the top of the stack into stdout
Usage:
```forth
69 print
```
How it works:
```ts
num = stack.pop()
console.log(num);
```
### Dup ("dup")
Dup duplicates the top most number on the stack
Usage:
```forth
69 dup
```
How it works:
```ts
stack = [12];
a = stack.pop();
stack.push(a);
stack.push(a);
console.assert(stack == [12, 12]);
```
### Drop ("drop")
Drop removes the top most number on the stack
Usage:
```forth
69 drop
```
How it works:
```ts
stack = [69];
stack.pop();
console.assert(stack == []);
```
### Rot ("rot")
Rot moves the third number from the top of the stack and moves it to the top
Usage:
```forth
1 2 3 rot
```
How it works:
```ts
stack = [1, 2, 3];
let a = stack.pop();
let b = stack.pop();
let c = stack.pop();
stack.push(b);
stack.push(a);
stack.push(c);
console.assert(stack == [3, 1, 2]);
```
### Over ("over")
Over takes the second number from the top of the stack and copies it to the top
Usage:
```forth
1 2 over
```
How it works:
```ts
stack = [1, 2];
let a = stack.pop();
let b = stack.pop();
stack.push(b);
stack.push(a);
stack.push(b);
console.assert(stack == [1, 2, 1]);
```
### Swap ("swap")
Swap swaps the first and second numbers from the stack
Usage:
```forth
1 2 stack
```
How it works:
```ts
stack = [1, 2];
let a = stack.pop();
let b = stack.pop();
stack.push(a);
stack.push(b);
console.assert(stack == [2, 1]);
```
### Plus ("+")
### Minus ("-")
### Mul ("*")
### Equals ("=")
### Gt (">")
### Lt ("<")
### NotEquals ("!=")
### Le ("<=")
### Ge (">=")
### Band ("band")
### Bor ("bor")
### Shr ("shr")
### Shl ("shl")
### DivMod ("divmod")
### Mem ("mem")
### Load8 ("@8")
### Store8 ("!8")
### Syscall0 ("syscall0")
### Syscall1 ("syscall1")
### Syscall2 ("syscall2")
### Syscall3 ("syscall3")
### Syscall4 ("syscall4")
### Syscall5 ("syscall5")
### Syscall6 ("syscall6")
### None ("None")
## Keywords
### If ("if")
### Else ("else")
### End ("end")
### While ("while")
### Do ("do")
### Macro ("macro")
### Include ("include")

View File

@ -1,2 +0,0 @@
**/*.log
**/node_modules/

View File

@ -1,17 +0,0 @@
// A launch configuration that launches the extension inside a new window
// 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": [
{
"name": "Extension",
"type": "extensionHost",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}"
]
}
]
}

View File

@ -1,4 +0,0 @@
.vscode/**
.vscode-test/**
.gitignore
vsc-extension-quickstart.md

View File

@ -1,9 +0,0 @@
# Change Log
All notable changes to the "mclang" extension will be documented in this file.
Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file.
## [Unreleased]
- Initial release

View File

View File

@ -1,17 +0,0 @@
# mclang README
Code highlghting for mclang 1 and 2
## Known Issues
None
## Release Notes
Users appreciate release notes as you update your extension.
### 1.0.0
Initial release of mclang
**Enjoy!**

View File

@ -1,30 +0,0 @@
{
"comments": {
// symbol used for single line comment. Remove this entry if your language does not support line comments
"lineComment": "//",
// symbols used for start and end a block comment. Remove this entry if your language does not support block comments
"blockComment": [ "/*", "*/" ]
},
// symbols used as brackets
"brackets": [
["{", "}"],
["[", "]"],
["(", ")"]
],
// symbols that are auto closed when typing
"autoClosingPairs": [
["{", "}"],
["[", "]"],
["(", ")"],
["\"", "\""],
["'", "'"]
],
// symbols that can be used to surround a selection
"surroundingPairs": [
["{", "}"],
["[", "]"],
["(", ")"],
["\"", "\""],
["'", "'"]
]
}

Binary file not shown.

View File

@ -1,42 +0,0 @@
{
"name": "mclang",
"displayName": "mclang",
"description": "Code highlighting for mclang",
"version": "0.0.3",
"repository": {
"type": "git",
"url": "git@github.com:mc-lang/mclang2.git"
},
"engines": {
"vscode": "^1.54.0"
},
"categories": [
"Programming Languages"
],
"contributes": {
"languages": [
{
"id": "mclang",
"aliases": [
"MCLang",
"mclang"
],
"extensions": [
".mcl"
],
"configuration": "./language-configuration.json"
}
],
"grammars": [
{
"language": "mclang",
"scopeName": "source.mcl",
"path": "./syntaxes/mclang.tmLanguage.json"
}
]
},
"dependencies": {
"generator-code": "^1.7.4",
"@vscode/vsce": "^2.15.0"
}
}

View File

@ -1,147 +0,0 @@
{
"name": "MCLang",
"fileTypes": [
"mcl"
],
"scopeName": "source.mcl",
"patterns": [
{
"include": "#errors"
},
{
"include": "#keywords"
},
{
"include": "#definitions"
},
{
"include": "#placeholders"
},
{
"include": "#strings"
},
{
"include": "#comments"
},
{
"include": "#intrinsics"
},
{
"include": "#constants-and-special-vars"
}
],
"repository": {
"errors": {
"patterns": [
{
"name": "invalid.illegal",
"match": "(?<=^|\\s)(?:const|memory)\\s+(end)(?:$|\\s)"
},
{
"name": "invalid.illegal",
"match": "(?<=^|\\s)(?:fn)\\s+(done)(?:$|\\s)"
},
{
"name": "invalid.illegal",
"match": "(?<=^|\\s)(memory|const)\\s+\\S*(\\s+|$)end(?:\n|\\s)"
},
{
"name": "invalid.illegal",
"match": "(?<=^|\\s)(inline)\\s+(?!fn(\\s|$))"
}
]
},
"keywords": {
"patterns": [
{
"name": "keyword.declaration.mclang",
"match": "(?<=\\s|^)(macro|memory|fn|const|in|inline|include|assert|offset|addr-of|call-like|reset|let|peek|with|returns)(?:\\s|$)"
},
{
"name": "keyword.control.mclang",
"match": "(?<=\\s|^)(if|else|elif|end|done|then|while|do|if\\*)(?:\\s|$)"
}
]
},
"definitions": {
"patterns": [
{
"name": "support.class.mclang",
"match": "(?<=(macro|memory|fn|const)\\s+)(\\S*)"
},
{
"name": "support.class.mclang",
"match": "(?<=(let|peek)\\s+)\\S+.*(?=\\s+(in))"
}
]
},
"placeholders": {
"patterns": [
{
"name": "markup.italic.mclang",
"match": "(?<=(\\s|^))_[\\S]*_(?:(\\s|$))"
}
]
},
"strings": {
"patterns": [
{
"name": "string.quoted.double.mclang",
"begin": "\"",
"end": "\"",
"patterns": [
{
"name": "constant.character.escape.mclang",
"match": "\\\\."
}
]
},
{
"name": "string.quoted.single.mclang",
"begin": "'",
"end": "'",
"patterns": [
{
"name": "constant.character.escape.mclang",
"match": "\\\\."
}
]
}
]
},
"comments": {
"patterns": [
{
"name": "constant.other.character-class.regexp",
"match": "(?://\\s*)(TODO(O*)|FIXME).*"
},
{
"name": "comment.line.double-slash.mclang",
"match": "(//(?!\\s?(TODO(O*)|FIXME)(\\s|:|$)).*|//\\s*)"
}
]
},
"intrinsics": {
"patterns": [
{
"name": "variable.name.source.mclang",
"match": "(?<=^|\\s)(\\+|-|\\*|int|ptr|bool|addr|any|void|max|divmod|_dbg_print|=|>|<|>=|<=|!=|>>|<<|\\||&|not|dup|swap|drop|over|rot|argc|argv|here|syscall0|syscall1|syscall2|syscall3|syscall4|syscall5|syscall6|\\?\\?\\?)(?=>$|\\s)"
}
]
},
"constants-and-special-vars": {
"patterns": [
{
"name": "constant.numeric.mclang",
"match": "\\b((0(x|X)[0-9a-fA-F]*)|(([0-9]+\\.?[0-9]*)|(\\.[0-9]+))((e|E)(\\+|-)?[0-9]+)?)\\b(?!\\$)"
},
{
"name": "entity.name.function.mclang",
"match": "(?<=^|\\s)(NULL|true|false|cast(ptr)|cast(int)|cast(bool)|sizeof\\(u64\\)|sizeof\\(u32\\)|sizeof\\(ptr\\)|sizeof\\(bool\\)|sizeof\\(int\\)|sizeof\\(addr\\)|STDIN|STDOUT|STDERR|@ptr|@@ptr|@bool|@int|@addr|!bool|!ptr|!int|!addr|AT_FDCWD|O_RDONLY|O_WRONLY|O_RDWR|O_CREAT|O_TRUNC|O_NONBLOCK|F_SETFL|F_GETFL|EAGAIN|CLOCK_MONOTONIC|TIMER_ABSTIME|MAP_PRIVATE|MAP_ANONYMOUS|PROT_READ|PROT_WRITE|SIGQUIT|timespec\\.tv_sec|timespec\\.tv_nsec|sizeof\\(timespec\\)|ptr\\+|ptr-|ptr!=|ptr=|ptr<|\\+ptr|ptr-diff|sizeof\\(stat\\)|stat\\.st_dev|stat\\.st_ino|stat\\.st_mode|stat\\.st_nlink|stat\\.st_uid|stat\\.st_gid|stat\\.st_rdev|stat\\.st_size|@stat\\.st_size|stat\\.st_blksize|stat\\.st_blocks|stat\\.st_atim|stat\\.st_mtim|stat\\.st_ctim|sizeof\\(stat\\.st_dev\\)|sizeof\\(stat\\.st_ino\\)|sizeof\\(stat\\.st_mode\\)|sizeof\\(stat\\.st_nlink\\)|sizeof\\(stat\\.st_uid\\)|sizeof\\(stat\\.st_gid\\)|sizeof\\(stat\\.st_rdev\\)|sizeof\\(stat\\.st_size\\)|sizeof\\(stat\\.st_blksize\\)|sizeof\\(stat\\.st_blocks\\)|sizeof\\(stat\\.st_atim\\)|sizeof\\(stat\\.st_mtim\\)|sizeof\\(stat\\.st_ctim\\)|write|read|openat|fstat|stat|close|exit|mmap|clock_nanosleep|clock_gettime|fork|getpid|execve|wait4|rename|fcntl|kill|dup2|/|%|mod|div|imod|idiv|emod|nth_argv|lnot|land|lor|inc64-by|inc64|dec64|inc32|dec32|inc8|dec8|swap64|cstrlen|cstreq|cstr-to-str|fputs|puts|eputs|WIFSTOPPED|WIFCONTINUED|WIFSIGNALED|WTERMSIG|WIFEXITED|WEXITSTATUS|offsetof\\(Str\\.count\\)|offsetof\\(Str\\.data\\)|sizeof\\(Str\\)|Str\\.count|Str\\.data|@Str\\.count|@Str\\.data|!Str\\.count|!Str\\.data|@Str|!Str|str-chop-one-left|str-chop-one-right|\\?space|str-trim-left|str-chop-by-predicate|str-chop-by-delim|str-starts-with|\\?str-empty|streq|\\?digit|isdigit|\\?alpha|isalpha|\\?alnum|isalnum|try-parse-int|PUTU_BUFFER_CAP|fputu|fput0u|putu|put0u|eputu|memcpy|memset|srand|RAND_A|RAND_C|rand|getenv|TMP_CAP|tmp-clean|tmp-end|tmp-rewind|tmp-alloc|tmp-str-to-cstr|tmp-append|tmp-append-ptr|execvp|append-item|tmp-utos|map-file|\\?file-exist|\\?shell-safe-char|\\?shell-safe-str|shell-escape|timeit/from-here|1e9|timeit/to-here|str-rfind|dirname|putch|remove-ext|cmd-echoed)(?:\\s|$)"
}
]
}
}
}

View File

@ -1,29 +0,0 @@
# Welcome to your VS Code Extension
## What's in the folder
* This folder contains all of the files necessary for your extension.
* `package.json` - this is the manifest file in which you declare your language support and define the location of the grammar file that has been copied into your extension.
* `syntaxes/mclang.tmLanguage.json` - this is the Text mate grammar file that is used for tokenization.
* `language-configuration.json` - this is the language configuration, defining the tokens that are used for comments and brackets.
## Get up and running straight away
* Make sure the language configuration settings in `language-configuration.json` are accurate.
* Press `F5` to open a new window with your extension loaded.
* Create a new file with a file name suffix matching your language.
* Verify that syntax highlighting works and that the language configuration settings are working.
## Make changes
* You can relaunch the extension from the debug toolbar after making changes to the files listed above.
* You can also reload (`Ctrl+R` or `Cmd+R` on Mac) the VS Code window with your extension to load your changes.
## Add more language features
* To add features such as IntelliSense, hovers and validators check out the VS Code extenders documentation at https://code.visualstudio.com/docs
## Install your extension
* To start using your extension with Visual Studio Code copy it into the `<user home>/.vscode/extensions` folder and restart Code.
* To share your extension with the world, read on https://code.visualstudio.com/docs about publishing an extension.

File diff suppressed because it is too large Load Diff

View File

@ -2,12 +2,12 @@ const NULL 0 end
const false 0 end
const true 1 end
fn div with int int returns int then divmod drop done
fn mod with int int returns int then divmod swap drop done
inline fn div with int int returns int then divmod drop done
inline fn mod with int int returns int then divmod swap drop done
fn dup2 with any any returns any any any any then over over done
fn drop2 with any any returns void then drop drop done
inline fn dup2 with any any returns any any any any then over over done
inline fn drop2 with any any returns void then drop drop done
const sizeof(u64) 8 end
const sizeof(u32) 4 end

View File

@ -5,7 +5,7 @@
// @arg buff_ptr: Ptr - pointer to the buffer to write
// @arg fd: Int - file descriptor
// @ret Int
fn write with int ptr int returns int then
inline fn write with int ptr int returns int then
SYS_write syscall3
done
@ -15,7 +15,7 @@ done
// @arg buff_ptr: Ptr - pointer to the buffer to write
// @arg fd: Int - file descriptor
// @ret Int
fn read with int ptr int returns int then
inline fn read with int ptr int returns int then
SYS_read syscall3
done
@ -25,7 +25,7 @@ done
// @arg buff_size: Int - number of bytes to write
// @arg buff_ptr: Ptr - pointer to the buffer to write
// @ret NULL
fn puts with int ptr returns void then
inline fn puts with int ptr returns void then
STDOUT write drop
done
@ -34,7 +34,7 @@ done
// @arg buff_size: Int - number of bytes to write
// @arg buff_ptr: Ptr - pointer to the buffer to write
// @ret NULL
fn eputs with int ptr returns void then
inline fn eputs with int ptr returns void then
STDOUT write drop
done
@ -44,7 +44,7 @@ done
// args: [exit_code]
// @arg exit_code: Int
// @ret NULL/NEVER
fn exit with int returns void then
inline fn exit with int returns void then
SYS_exit syscall1 drop
done