I have written an initial version of 'nscc' with support for creating 
native interfaces by parsing an 'nsi' file.

[panc...@dazo nscript]$ cat libc.ns
# test program for libc.nsi
dup print "\n" print
"food"
ns_pop
"one" "one" strcmp $x
"one" "two" strcmp $y
"strcmp one-one: " print x print "\n" print
"strcmp one-two: " print y print "\n" print
"ls" system
# "echo 'hello world'" system
{ "true\n" print } $t
"false" t ns_pop
# print
exit

[panc...@dazo nscript]$ cat libc.nsi
i:s:system
i:s-s:strcmp
-:-:ns_pop

The command to compile the nscript will be:

[panc...@dazo nscript]$ ./nscc -i libc.nsi libc.ns

[panc...@dazo nscript]$ ./a.out
strcmp one-one: 0
strcmp one-two: 1
Makefile  Todo   include  libc.ns.c  libnscript.a  ns.c  nscc  src
ReadMe    a.out  libc.ns  libc.nsi   ns            ns.o  p     test
true

-------

I have only added support for string and integer types.

Feel free to import this code into your repo.

--pancake

Reply via email to