capy-language/capy

Command-line arguments

NotAFlyingGoose opened this issue · 1 comments

Problem

It's currently impossible to access command line arguments.
This is definitely needed before 0.1.0 on crates.io

Proposed Solution

argc and argv are currently taken in as parameters in the codegen crate, but codegen doesn't do anything with these values.

What should be done is there should be a builtin slice in core called args or smth (maybe figure out a better name for this).
At runtime in the cmain function just before the actual main function is called, codegen should create the slice using argc and argv and store it into this builtin global.

boom! command-line arguments

Notes

The builtin should be similar to other builtins, so it only gets generated if it actually gets used

I'm gonna start working on this