Soulver in Prolog

Though I’ve never used it, Soulver looks like an interesting calculator for the Mac and iPhone. Essentially, it detects a limited set of English phrases to make calculations look like natural language. For example, “5 as a % of 50” returns 10. I want to do something similar, but I don’t want to write a lot of code. Prolog supports definite clause grammars (DCG), which is a convenient way to write limited parsers in Prolog. I stole someone’s tokenizer, borrowed someone’s chunk parser, and am now adding rules to generate ASTs from natural language math phrases. The only thing slowing me down is the complete lack of documentation for everything. I haven’t used Prolog in 20 years, but it’s slowly coming back to me.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s