Little is a statically typed,
C-like scripting language.
Features
- Familiar C-like Syntax
- Structs, lists, arrays, hashes
- Perl regexp: buf =~ /.*foo/, I/O: while (buf = <>)
- No memory management (reference counted)
- Compiles to Tcl byte codes, Little can call Tcl, Tcl can call Little
- Full access to Tcl runtime and libraries
- Full access to Tk graphical toolkits
/* trivial grep implementation */
int
main(string argv[])
{
string buf, regexp;
int ret = 1; // not found is default
unless (regexp = argv[1]) die("usage: grep regexp [files]");
undef(argv[1]); // left shift down the args
/*
* Example perl goodness, the iterate through files and regexp
*/
while (buf = <>) {
if (buf =~ /${regexp}/) {
puts(buf);
ret = 0;
}
}
return (ret);
}