import TokenType.* class Semantic { /** * Checks and validates whether the code complies with the semantic rules * TODO: Handle scopes via { and } */ fun check(statements: MutableList>): Boolean { val variables = mutableListOf>() statements.forEach { statement -> if (statement[0].type == Variable) { if (nextNonEmpty(statement, 0).type == Assignment) { variables.add(statement.take(5)) } } } return true } }