An experiment in parentheses-free lisp (in JavaScript)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

21 lines
443 B

#! /usr/bin/node
// Tokenization, with no regular expressions, ala Rob Pike :)
var TokenStream = {
lookahead :
function(n) {
return this.tokstream.slice(0,n);
}
}
function MakeTokStream(tokens) {
this.tokstream = tokens;
}
MakeTokStream.prototype = TokenStream;
var input = process.argv.slice(2).reduce(function(acc, x) {return acc + " " + x}, "");
var test = new MakeTokStream(input);
console.log(test.lookahead(8));