3 ms·
These days you can benefit from minilanguages without actually implementing them. It is surprisingly easy to embed JS or Lua into your program. Recently I was
by Snawoot 5y ago
These days you can benefit from minilanguages without actually implementing them. It is surprisingly easy to embed JS or Lua into your program.
Recently I was looking for Linux games which match my taste at some Russian torrent site. Search engine on it is not particularly good, it allows search only on torrent title. While each torrent description contains genre, year and a lot of other info which is pretty approachable for machine interpretation.
So I found XML dump of tracker database (about 22 GB) with torrent descriptions and built tool which allows to process torrent records with an arbitrary JS script to filter records. Like AWK, but suited for specific XML input and scripted with JS.
This way I could filter games based on year, genre and gaming engine. JS engine I used is implemented in pure Go, so it doesn't introduce additional runtime dependencies. With such approach it's easy to write any search query, aggregation and so on.
BTW, here is the project link: https://github.com/Snawoot/trusearch https://github.com/Snawoot/trusearch
Pure-Go JS engine: https://github.com/dop251/goja https://github.com/dop251/goja