bool

a bool is true or false.

this language bites a bool.

TRANSLATED:



super super easy. [just] make a term.

class BoolTerm extends Term {
	//...
}

give it a name...

class BoolTerm extends Term {
	name() {
		return "bool"
	}
}

checking is easy.

class BoolTerm extends Term {
	check(text) {
		return text.startsWith("true") || text.startsWith("false")
	}
}

biting is easy too.

class BoolTerm extends Term {
	bite(text) {
		if (text.startsWith("true")) {
			return "true"
		}
		if (text.startsWith("false")) {
			return "false"
		}
		return null
	}
}

only need to preview the first 5 characters.

class BoolTerm extends Term {
	preview(text) {
		return text.slice(0, 5)
	}
}

that's it!

back to the dream