0xol / pyraxis

subset of python3 with extensions, transpiles to C

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pyraxis

subset of python3 with extensions, transpiles to C

file types

.pyr - pyraxis code
.pyh - pyraxis header

command line arguments

-o 'x' - filename/path to output resulting code/binary (this is fed to the C compiler)
-cc 'x' - c compiler to be invoked
-cc_flags='x' - flags to parse to the C compiler
-c - tells the C compiler to output an object and not a final executable
-nstdlib - disable the stdlib (non existent currently, arg implemented so freestanding code can be built by future versions)
-i - tells pyraxis where to look for .pyh (can be defined multiple times)

provided freestanding types

int - (translates to i32)
i8
u8
i16
u16
i32
u32
i64
u64

const - cannot be changed after definition
*'type' - pointer to another object with 'type' as its type
void - no explicit type
[] - array

new keywords

c_attribute('x') - can be put before object definiton to add an attribute (x) to the created C file. ("packed", etc)
& - can be used to get the location in memory of an object
extern - used to define an externally defined objecy, can be used to create a binding with C code or act as a header for a library (C or pyraxis)

differences from python, synatax/function wise

pointers and pointer arithmetic
variable must define type on definition
functions must define return type and arguement types on definition (excluding '...', this will directly translated to C)
functions cannot be defined in classes

stdlib

pyraxis currently does not have stdlib (keyword being currently)
you can use the C library and extern to achieve a sort of stdlib

intergration with C

you can make a pyraxis header (.pyh) with extern definitons to bind to C
to bind pyraxis code to C, you can make a C header file with defintions of the .pyr file

About

subset of python3 with extensions, transpiles to C

License:GNU General Public License v3.0


Languages

Language:Python 100.0%