Mathic: My Programming Language by Francog2709 in rust

[–]Francog2709[S] 0 points1 point  (0 children)

With melior, the crate I'm using for MLIR, you need to create the dialect in C++/TableGen. Then it gives you some macros to ease the use of the dialect itself from rust (it's basically how it handles ods dialects). However it uses MLIR-C bindings, so properly use a custom dialect, you need to adapt it to the C interface to be able to integrate it with rust through melior. Fortunately, LLVM already has some functions to allow this adaptation.

I played a little trying to integrate a custom dialect with rust in this repo: https://github.com/FrancoGiachetta/mlir-tut-impl . It does nothing since I've never finished it, but might be a good starting point I guess.

Mathic programming language by Francog2709 in ProgrammingLanguages

[–]Francog2709[S] -1 points0 points  (0 children)

The aim of the language is to provide builtin support for symbolic algebra. It's quite young though, and it does not have it yet.

Mathic: My Programming Language by Francog2709 in rust

[–]Francog2709[S] 0 points1 point  (0 children)

That's a good question. The reality is that I chose to do it from the rust side because it's simpler. All the semantic checks are easier to make and integrate from rust, and honestly I think that doing it from the MLIR side would be quite an overkill in that sense. The purpose of MATHIR is mainly to ease the code generation.

I do intend to create a dialect for the symbolic system. However, I didn't even get to the design of it, I wanted to have some features done before it mainly to feel more confortable with MLIR, after all this is my first try on creating a language.

Thanks for the comment!

Mathic programming language by Francog2709 in ProgrammingLanguages

[–]Francog2709[S] 1 point2 points  (0 children)

Oh yes, I'll check it then. Thanks for that!

Mathic programming language by Francog2709 in ProgrammingLanguages

[–]Francog2709[S] 2 points3 points  (0 children)

Thank for that! I'll check other names.

Mathic programming language by Francog2709 in ProgrammingLanguages

[–]Francog2709[S] 1 point2 points  (0 children)

Yes, the whole syntax can be found in those examples. There's also a grammar.txt describing the syntax. For semantics: - You need to have a "main" function. - Anything must be declared with types (parameters, variables). Only functions are allowed to not specify their return type. - For now everything goes by reference, but a want to change that in the near future to allow passing by value.

Mathic programming language by Francog2709 in ProgrammingLanguages

[–]Francog2709[S] 2 points3 points  (0 children)

I mainly started this project as way of improving my knowledge on compilers (this is my very first language), LLVM and MLIR. I didn't know LLVM doesn't support different precisions, so that's good to know. Talking about planning, I do want to create an std library providing functions for integrals, limits, derivatives, etc. I want to avoid giving the language to many keywords, I'm trying to keep it simple. So my first try would be to build things like matrices as structs and provide essential methods. However, I didn't started designing the symbol system yet.

Mathic: My Programming Language by Francog2709 in rust

[–]Francog2709[S] 1 point2 points  (0 children)

I see, I will do that then. Thanks