Git Product home page Git Product logo

compiler's Introduction

Telegram Badge Stepik Badge Kaggle Badge Coursera Badge visitors GitHub Urezzzer


Hi there 👋

I'm Iurii, a Data Scientist

  • have experience working with ML, DL, Time Series, NLP, CV, Audio
  • have management project skills (Software engineering at FEFU)
  • know basic of graphic design
  • studying high maths

I develop various models for practical purposes and also quite often participate in professional activities.

More about me

I am studying software engineering at fefu, completed Deep Learning School, as well as courses at Coursera. Often I participate in hackathons to develop my hard and soft skills.

💼 Skills

More Skills


🏆 GitHub Profile Trophy

trophy

📈 GitHub Stats


Martin's GitHub Stats

compiler's People

Contributors

tureevs avatar urezzzer avatar

Watchers

 avatar

compiler's Issues

Bugs

1) Крашится питоновский скрипт, если input файл пустой
2) У cpp файлов обязательно должен быть int main() {}
3) ; после третьего блока в цикле не ставится. Верный кейс:

for (int i = 0; i < 10; i++) {}

С функциями аналогично, ; не ставим. Так будет правильно:

int foo() {
}

input.txt поменял на input.cpp, чтобы видеть подсветку синтаксиса
Убрал файлы, которых не должно быть под контролем версий
Докеризировал

Крашится приложение

На следующем кейсе крашится приложение:

int main() {
    for (int i = 0; i < 50; i = i + 1) {
        i = i + 1;
    }
}
Traceback (most recent call last):
  File "parser.py", line 46, in <module>
    main()
  File "parser.py", line 41, in main
    p.parse('./input.cpp', './output_lexer.txt',
  File "parser.py", line 31, in parse
    self.semantic_analyser.parse(self.syntax_analyser.tokens, self.syntax_analyser.positions,
  File "/compiler/semanticanalyser.py", line 58, in parse
    self.Start()
  File "/compiler/semanticanalyser.py", line 133, in Start
    self.Statement()
  File "/compiler/semanticanalyser.py", line 162, in Statement
    start = self.For_Loop()
  File "/compiler/semanticanalyser.py", line 323, in For_Loop
    self.Statement()
  File "/compiler/semanticanalyser.py", line 148, in Statement
    start = self.Assignment((self.backup('lexeme'), self.cur_depth))
  File "/compiler/semanticanalyser.py", line 204, in Assignment
    elif self.Instruction(_id):
  File "/compiler/semanticanalyser.py", line 228, in Instruction
    if self.Expression(_id):
  File "/compiler/semanticanalyser.py", line 360, in Expression
    if self.Term(_id):
  File "/compiler/semanticanalyser.py", line 385, in Term
    if self.Factor(_id):
  File "/compiler/semanticanalyser.py", line 480, in Factor
    if self.ids_to_tokens[_id] != self.ids_to_tokens[(self.backup('lexeme'), self.cur_depth)]:
KeyError: ('i', 2)

Типизация в функциях

Такой кейс прошел, хотя не должен был

int foo() {
    return 4;
}

std::string bar() {
    return foo();
}

int main() {
    int a = foo() + bar();
}

Неправильно работает кол-во параметров в функции

Не отрабатывает кейс, когда передаем параметров меньше, чем в сигнатуре.

int foo(int a, int b) {
    return a + b;
}

int main() {
    int a = foo(2);
}

При этом корректно отрабатывает кейс, когда параметров передаем больше, чем в сигнатуре.

int foo(int a, int b) {
    return a + b;
}

int main() {
    int a = foo(2, 3, 4);
}
Error: Wrong count of arguments. [6,21]

Сделал покрытие этих двух кейсов в Pull request

Ошибки типизации

Кейс с сложением числа и строки не должен отрабатывать, возможно, у других типов такое же поведение:

int foo()
{
    return 5 + "dd";
}

int main() {}

Кейс со сложением строк также не должен отрабатывать:

int main() {
    std::string a = "aa" + "dd";
}

Строки в плюсах конкатенируются вот так (потому что в c++ строки обернутые в "" - это const char и на них не действует оператор +):

int main() {
    std::string a = "aa";
    std::string b = "bb";
    std::string c = a + b;
}

Ошибка с Not initialized a variable

Не отработал корректный кейс

int foo()
{
    return 15;
}

int main() {
    int a = 5;
    int b = 10;
    int c = a + b + foo();
}

Отдает

Lexeme: foo  Token: IDENTIFIER
Error: Not initialized a variable. [9,23]

Неправильно работают комментарии

В errors.txt пишется

ERROR                INDEX_TOKEN             

ErrorTypes.NOT_VALID     LexerToken.NOT_EXISTS   

на следующий кейс

int main()
{
    // $^/int a0 = 0 + 0;
}

По идее этой кейс должен был отработать корректно, т.к single комментарий подразумевает игнорирование всего, что находится справа

Несоответствие кол-ва параметров

Такие кейсы отрабатывают корректно, хотя не должны. Не соответствует кол-во передаваемых и получаемых параметров.

int foo(int a) {
    return a;
}

int main() {
    int a = foo();
}
int foo(int a) {
    return a;
}

int main() {
    int a = foo(2, 2);
}

Область видимости переменных

Семантический анализатор разваливается на таком кейсе

int foo() {
    int a = 3;
}

int main() {
    int a = 3;
}

Выдает

Error: Reinitializing a variable. [6,9]

Область видимости этих переменных не пересекается.

Зацикливается программа

Программа зацикливается на следующих кейсах:

int foo() {
    return 0;
}

    foo();

    for (int i = 0; i < 10; i = i + 1) { /* 3 */
        int a = a + i;
    }
}
int foo() {
    return 0;
}
$
int main() {
    foo();

    for (int i = 0; i < 10; i = i + 1) { /* 3 */
        int a = a + i;
    }
}
int foo() {
    return 0;
}
+
int main() {
    foo();

    for (int i = 0; i < 10; i = i + 1) { /* 3 */
        int a = a + i;
    }
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.