Implementation of IEC 1131-7 in javascript