edubart / nelua-lang

Minimal, efficient, statically-typed and meta-programmable systems programming language heavily inspired by Lua, which compiles to C and native code.
https://nelua.io
MIT License
1.99k stars 64 forks source link

support windows msvc cl compiler #224

Closed zeromake closed 1 year ago

zeromake commented 1 year ago

Feature motivation

I want to use MSVC on Windows

Code example

on my fork already achieved

> "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat" amd64
> .\nelua.bat --verbose examples\fibonacci.nelua
generated ~\.cache\nelua\fibonacci.c
cl -nologo /utf-8 /EHsc /Zi /Fe"~\.cache\nelua\fibonacci.exe" "~\.cache\nelua\fibonacci.c"
fibonacci.c
C:\Users\ljh\.cache\nelua\fibonacci.exe
55
55
55
55

I would have liked to come up with a PR, after carefully reading the PR description decision, let's mention an issue first If you don't feel the need msvc support(nelua some generate c code unable to compile), just turn close this issue.

edubart commented 1 year ago

You should try using MSVC Clang if that is an option for you. Then you don't need to do anything. I am afraid the cl compiler doesn't support all features Nelua need, you could check by running the test suite. Nelua may occasionally generate C code using extensions such as https://gcc.gnu.org/onlinedocs/gcc/Statement-Exprs.html that only GCC/Clang supports AFAIK. (See also https://github.com/edubart/nelua-lang/discussions/73)

That is interesting, but not sure if I want to add that officially, unless everything is working good. I really want to encourage just using the Clang/GCC frontend.

zeromake commented 1 year ago

@edubart Statement-Exprs are more problems, need to redo cgenerator, I'll close this issue.