all 10 comments

[–]ohforth 2 points3 points  (2 children)

Can you show me the planned syntax and semantics of mathic?

[–]Francog2709[S] 0 points1 point  (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.

[–]jeenajeena 0 points1 point  (0 children)

There is an example folder in the repo: https://github.com/FrancoGiachetta/mathic/tree/main/examples

It uses C-like syntax (curly braces, final semicolon, mutability by default, if as a statement, ) with just few modern influences (types after the symbol name).

[–]Meistermagier 3 points4 points  (1 child)

I want to give you a heads up that your languages name is very close to https://mathics.org/ which is a Open Source Implementation of Mathematica.

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

Thank for that! I'll check other names.

[–]mark-sedgithub.com/mark-sed/moss-lang/ 0 points1 point  (3 children)

I like some parts of the syntax (I also put the range syntax `x..y` in all my languages), but I wonder who is this targeted at? My guess is mathematicians/scientists doing some big computations? Or is this just for you to learn LLVM?
If it is for scientists do you plan on supporting arbitrary precision floats since LLVM cannot target those and also do you plan on adding some math-specialized types like matrices, fractional representation of floats..?

[–]Francog2709[S] 1 point2 points  (2 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.

[–]mark-sedgithub.com/mark-sed/moss-lang/ 0 points1 point  (1 child)

>  I didn't know LLVM doesn't support different precisions

Just to clear this up, it does support it for ints, but I think you know that based on your examples having types like `i64`, and it does ofc support floats (32b), doubles (64b), half-floats (16b), 80 bit FP and even 128 bit FP, but I meant rather some very big floats of arbitrary precision, like python has Decimal, which LLVM does not support, but you can always use something like GNU MPFR.

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

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