yus1108 / mcf

This is a toy compiler project named as mcf (making compiler is fun) aiming to make a compiler specialized for game development.
MIT License
1 stars 0 forks source link

[evaluator] 기본적인 평가기 개발 #18

Closed yus1108 closed 1 month ago

yus1108 commented 1 month ago

builtins.mcfh

enum PRINT_RESULT : uint8
{
    NO_ERROR
};

const PRINT_RESULT Print(const utf8 format[], ...) const;

main.mcf

#include <builtins> // include vector, string, print

// unused parameters must be set as unused
// Print is builtin function that prints output to console
// TODO: command line argument 받는법 필요
// TODO: return type for main?
void main(unused const int32 argc, unused const utf8 argv[][]) 
{
    const utf8 str[] = "Hello, World!"; // default string literal is static array of utf8 in mcf
    Print("%s\n", str); 
}

위 코드의 syntax 를 평가하는 평가기 개발

yus1108 commented 1 month ago

필요 토큰 :

yus1108 commented 1 month ago

필요/수정 general expressions:

Expression: Prefix:

Infix:

Infix Expressions

필요 special expressions (parse expression에 의해 파싱 되지 않는 expressions):

필요/수정 statements:

yus1108 commented 1 month ago

x86 nasm 코드 구현

yus1108 commented 1 month ago

현재 단계에선 평가 단계에서 할수 있는일은 enum 정도 밖에 없어 이슈를 닫기로 결정