harrego / ape Goto Github PK
View Code? Open in Web Editor NEWGeneric C style language -> elf64 NASM transpiler
Generic C style language -> elf64 NASM transpiler
I propose to add the following syntax to ape to support list datatypes. As you can see, it is very simple and easy to use and leaves all the control up to the user of how they want to implement it.
/* %% DEFINEIFNOT DEFINED "ape_list.apeh" SUBMODULE */
ls_create()
var param:size = "".unsafe_to_integer_defaulting_to("0".unsafe_to_integer());
var list = "".unsafe_create_mutable();
APE_BUILTIN_STRING_UTF16
{
/* create a mutable string to store our list */
unsafe_mutable_append($list.unsafe_get_pointer(), ""+$param+size.unsafe_to_integer());
return $list.to_unsafe().get_managed_vm().get_pointer().as_utf_16().unwrap_unsafe_global().to_returnable();
}
ls_addnode()
var node
var list
void
{
unsafe_mutable_get_container_type($list, $list.get_pointer().safe_to_unsafe_global().to_ref());
unsafe_mutable_append($list.unsafe_get_pointer(), ""+$node+$node.get_managed_vm().get_pointer().as_utf_16().first()>>size.unsafe_to_integer());
}
/* %% ENDDEFINE */
/* %% APE_INCLUDE_SUBMODULE "ape_list.apeh" */
var ls = "";
var rs = APE_CREATE_RESULT_TYPE("Ok|Err[APE_BUILTIN_STRING_UTF16:e:DEFAULT:\"\"]".__APE_TO_STRUCT().unwrap_unsafe_char_array());
/* run some code in the interpretor state to store the result of the operation since ape doesnt have structs */
APE_CONTEXT_INTERP_RUN(rs, "rs.emit(=ret, [ctx], [=rs:])");
ls_create($ls.unsafe_get_pointer().to_ref());
if (ls!=""){ /* ls will be memory dump from raw RAM memory */
ls_append($ls.unsafe_get_pointer().to_ref().try($rs);
if (rs_Err) {
print("ERR: "+rs_Err_getParameter_APE_BUILTIN_STRING_UT16__symbol_table_get_e+"");
}
}
APE_MM_FREEPTR($ls.unsafe_get_pointer());
APE_CONTEXT_INTERP_CLOSE();```
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.