[dev] nscript - nscc

From: pancake <pancake_AT_youterm.com>
Date: Thu, 26 Aug 2010 04:11:42 +0200

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

[pancake_AT_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

[pancake_AT_dazo nscript]$ cat libc.nsi
i:s:system
i:s-s:strcmp
-:-:ns_pop

The command to compile the nscript will be:

[pancake_AT_dazo nscript]$ ./nscc -i libc.nsi libc.ns

[pancake_AT_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
Received on Thu Aug 26 2010 - 04:11:42 CEST

This archive was generated by hypermail 2.2.0 : Thu Aug 26 2010 - 04:24:03 CEST