A metalogic programming approach: Language semantics and applications