This is a compiler frontend for my toy language, RubbishLanguage(rblang). This frontend will generate MSIL and depends on .Net Core
Updated at 2021-02-14
Alright, new plan. This project will interpret source code and generate MSIL, then execute it on CLR. It seems that the new API of AssemblyBuilder does not support saving the CIL to disk, so this project becomes an interpreter.
- i64 - 64-bit integer
- f64 - 64-bit float point
- char - 16-bit character
- str - string
- void
- if
- else
- elif - else if
- loop - just like while in C/C++
- break
- continue
- and - python style condition operator &&
- or - ||
- not - !
- func
- return
operator | precedence(the higher, the better) |
---|---|
=(assign) | 1 |
or | 2 |
and | 3 |
== | 4 |
< | 5 |
<= | 5 |
> | 5 |
>= | 5 |
+ | 6 |
- | 6 |
*(multiplication) | 7 |
/ | 7 |
% | 7 |
not | 8 |
address_of | 8 |
any token starts with '@'
- @entry - the entry of the program
- @import - import a function
2021-02-05
Currently, the lexer is finished and the test is passed. But the lexer still has some problems, such as the line/column counter. And char type is not implemented. I think the lexer need more test cases.
2021-02-14
Implemented a parser, which convert token stream to abstract syntax tree. But I forgot to handle loop statement
- Lexer
- Parser
- Semantic analysis
- CodeEmitter
- Fix column counting problem for RbLexer
- Array types
- Dot operator(.) and struct type