4 ms·
If I'd waited until the interpreter to work before I wrote tests, I'd never have gotten a working interpreter. For atom the implementation is obvious, but the m
by wolfgang42 10y ago
If I'd waited until the interpreter to work before I wrote tests, I'd never have gotten a working interpreter. For atom the implementation is obvious, but the more complex functions were riddled with bugs on the first implementation, and the lexical scope handling took about three complete rewrites before I got it right.
If this had gone any further than the three days of off-hours time I spent, I certainly would have rewritten the test suite in Lisp; however it was primarily an academic exercise to really 'get' how Lisps worked and push my comfort level; writing all of my tests in the language I was trying to write would have pushed things a bit to far.
In fact, I never got around to writing a parser, so even if I'd written them in Lisp it would have looked like this:
var Symbols = require('../Symbols')
var natives = require('../natives')
var foo = Symbols.get_symbol_named('foo')
module.exports = [
natives.tests,
[natives.it, [natives.atom, [natives.quote, foo]], true],
[natives.it, [natives.atom, [natives.quote, []]], true],
]