melt-umn / silver

An attribute grammar-based programming language for composable language extensions
http://melt.cs.umn.edu/silver/
GNU Lesser General Public License v3.0
57 stars 7 forks source link

Support main being a concise function #799

Closed krame505 closed 5 months ago

krame505 commented 1 year ago

When we implement #454, one may wish to write main as a "concise function", which will be an extension that just forwards to a global:

fun main IO<Integer> ::= args::[String] = do {
  print("Hello, world");\n
  return 0;
};

So we should tweak the translation for globals named main to check that it has the right signature, and generate the main class declaration.

Tentatively assigning this to @unironically since this is related to #454.

krame505 commented 8 months ago

With #827, we don't really care as much about main being a global. But signature checking and automatic generation of a main class should happen for concise functions named main, too.