Add the code the check the semantic

Not test yet:)