Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature request] Add Nim language #8

Closed
ringabout opened this issue Apr 17, 2021 · 7 comments
Closed

[feature request] Add Nim language #8

ringabout opened this issue Apr 17, 2021 · 7 comments

Comments

@ringabout
Copy link
Contributor

ringabout commented Apr 17, 2021

Hi, could you add Nim language?

Nim is a system language using automatic reference counting with destructors and move semantics to manage memory. It supports C/C++/JS backends. Nim has a powerful macro system which allows direct manipulation of the AST, offering nearly unlimited opportunities.

The website:
https://nim-lang.org

The Github repo:
https://github.com/nim-lang/Nim

Installation:
https://nim-lang.org/install.html

debug build: nim c --gc:arc app.nim
release build: nim c --gc:arc -d:release app.nim
check?: nim check app.nim

Sample code:

proc add_long_n0_h0(x: int): int =
  return x + 15440

proc add_long_n0(x: int): int =
  return x + add_long_n0_h0(x) + 95485

proc add_long_n1_h0(x: int): int =
  return x + 37523

proc add_long_n1(x: int): int =
  return x + add_long_n1_h0(x) + 92492

proc add_long_n2_h0(x: int): int =
  return x + 39239

proc add_long_n2(x: int): int =
  return x + add_long_n2_h0(x) + 12248


var long_sum = 0;
long_sum += add_long_n0(0)
long_sum += add_long_n1(1)
long_sum += add_long_n2(2)
@nordlow
Copy link
Owner

nordlow commented Apr 17, 2021

I'll try.

@nordlow
Copy link
Owner

nordlow commented Apr 17, 2021

Hi, could you add Nim language?
debug build: nim c --gc:arc app.nim
release build: nim c --gc:arc -d:release app.nim
check?: nim check app.nim

You can give master a try now.

I've added support for check and debug builds support. Feel free to modify and propose pull requests as you wish. compiler-benchmark currenly only tests debug build performance.

There are lots of flags here and I don't know what to enable by default so go ahead you and propose whatever you prefer at https://nim-lang.org/docs/nimc.html

@nordlow
Copy link
Owner

nordlow commented Apr 17, 2021

The flag --gc:arc doesn't work on nim version 1.0.6 packaged with Ubuntu 20.04 but works with version 1.2.6 packaged on Ubuntu 21.04. Is there a different betweeen --gc:arc and --gc:refc? I'm gonna use --gc:refc for now because it works on Ubuntu 20.04.

@ringabout
Copy link
Contributor Author

Is there a different betweeen --gc:arc and --gc:refc

refc is the default memory management method. arc is introduced since 1.2.x.

You can give master a try now.

Nice, thanks!

@ghost
Copy link

ghost commented Apr 18, 2021

@nordlow 1.0.6 and even 1.2 are quite old releases, it's really preferable to have 1.4

@ringabout
Copy link
Contributor Author

ringabout commented Apr 18, 2021

Yeah as @Yardanico suggested, can you use curl(choosenim) to install latest Nim?

curl https://nim-lang.org/choosenim/init.sh -sSf | sh

https://www.osradar.com/nim-programming-language-ubuntu-debian

BTW system is imported implicit, so it is unnecessary to import it.

nordlow added a commit that referenced this issue Apr 18, 2021
@ringabout
Copy link
Contributor Author

thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants