+
Skip to content

crnvl/comfy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

80 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

comfy logo

comfy is a low-level, compiled scripting language with direct arm32 syscall access.

Features

  • Direct access to arm32 syscalls

  • Simple syntax for low-level programming

  • Compiles to arm32 assembly

Example


fn main() {

$write(1, "hello comfy!\n");

  

let hello_text = ":3\n";

$write(1, hello_text);

  

$exit(703);

}

Currently supported syscalls

comfy provides direct wrappers to arm32 syscalls, stripping away

boilerplate code such as setting up registers manually.

Syscall wrappers are prefixed with $.

The following syscalls are currently supported or next in development:

Supported? Syscall # Syscall Name Wrapper Function Description Return Value
1 exit $exit(status) Terminate the calling process. Does not return.
3 read $read(fd, buf) Read from a file descriptor. Number of bytes read, or -1 on error.
4 write $write(fd, buf) Write to a file descriptor. Number of bytes written, or -1 on error.
5 open $open(path, flags) Open a file. File descriptor, or -1 on error.

Variables

comfy supports simple variable declarations using the let keyword. Variables can hold string literals, or numbers. They can also be used to refer to empty buffers in memory.

Example


fn main() {

let text = "hello!\n";

$write(1, text);

  

let code = 0;

$exit(code);

}

You can also reference fixed-size buffers using square brackets. This is especially useful for working with read() and other syscalls that require writeable memory pointers. Assigning return values to variables in one line is also possible.


fn main() {

buf[128] comfySpace; // Declare a 128-byte buffer

let inputSize = $read(0, comfySpace); // Read from stdin into comfySpace and return the amount of bytes read

  

let code = 0;

$exit(code);

}

Roadmap

Project progress, planned and future features can be viewed on the Project board.

About

Low-level scripting language for fast arm32 development.

Topics

Resources

License

Stars

Watchers

Forks

Contributors 3

  •  
  •  
  •  
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载