GPLFEIMC, A programming language meant for embedding.
Caution
Shouldn't be used currently
A very work in progress programming language.
The file goal.gplefimc has what an example file in the programming language once it's finished will be.
Excerpt from goal.gplfeimc
declare Main f:main # declare entrypoint (declare can also be used to export variables and functions)
require lib:Math # import, returns null if it fails
require lib:Random # import, returns null if it fails
demand interface:FileAccess as fa # import, throws an error if it fails
@main(args) do # function declaration
print(args["1"])
print(args._.1)
$r = fa.open("user://test.txt","w") > The user:// directory uses a unique directory for every app
r = $r # Makes $r a global variable instead of local--- They could've just directly wrote to r, but maybe they have a reason.
if r.status == 0 then
print("test")? # prints debug info
fa.write(r.stream,input())
end
match r.status for
item 0 then print("File Opened Correctly!") end
item Err.DiskFull then
print("Your disk is full!")! # ! is basically a breakpoint. It just logs the current state of the program and waits until [ENTER]/[RETURN] is pressed.
end
end
enddeclare Main f:main
@main(args) do
# add the last two items in the stack: A, B, add
1 2 add
# subtract the last two items in the stack: B, A, sub
1 sub
# set variable on tape: DATA, LOC, set
5 set
# get variable from tape: LOC, get
5 get
# multiply last two items in the stack: A, B, mul
2 mul
# duplicate last item in the stack: A, copy
copy
# print: A, out
out
# divide: B, A, div
2 div
# floor
floor
3 div
# exponent: B, A, exp
2 exp
# ceil
ceil
out
endI want an actually good language for embedding, that doesn't involve manipulating the stack just for calling a function with an argument.