Help Command
coco help [command]
The help
command prints the commands and options, when [command] is passed, the help for specific command is printed.
Version Command
coco version
The version
command prints the current version of the Cocolang installation.
Optional Flags
flag | description | supported values |
-s, --supress-banner | suppress the cocolang figlet banner | n/a |
Nut Command
coco nut init <module_name>
The nut
command manages coco.nut
file, the manifest file for a module of .coco
source file(s). Currently, the only subcommand is `ìnit`, that creates a new coco.nut
file in the current folder, with the following contents:
[coco]
version = "0.3.0"
[module]
name = "Module"
version = "0.0.1"
license = []
repository = ""
authors = []
[target]
os = "MOI"
arch = "PISA"
[target.moi]
format = "YAML"
output = "module.yaml"
[target.pisa]
format = "BIN"
[dependencies.local]
While all fields in the coco.nut
file are mandatory, the only currently supported target is MOI Manifests (os = “MOI”) for the PISA runtime (arch = “PISA”), so only [target.moi] and [target.pisa] parameter values affect compilation. Allowed values for these parameters are:
[target.moi]
// output format, the output file extension will be
// .yaml, .json or .polo, respectively
format = "YAML", "JSON" or "POLO"
// output file name (with extension) - by default, it's lowercase module name
output = "module.yaml"
[target.pisa]
// format of executable code in PISA manifest
// "ASM" and "HEX" supported from Coco compiler release v0.3.1
format = "BIN", "ASM" or "HEX"
Optional Flags
flag | description | supported values |
-f, --force | allow overwriting coco.nut file in the current folder, if it exists | n/a |
Compile Command
coco compile [path_to_coco.nut]
The compile
command compiles a .coco
source(s) of a module into a target artifact as defined in the coco.nut
file. When called without specified path to a coco.nut
file, the file in the current folder is used and the target artifact is created in the current folder. When path is specified, the artifact is created in the same folder, as coco.nut
file.
Source .coco
files can have any file names, but only the ones with coco <module_name>
that matches module.name
in the coco.nut
file are used for compilation. Multiple source files for a single module are supported from v0.3.2.
Optional Flags
flag | description | supported values |
--debug | print the opcodes of compiled functions | n/a |
--ast | print the AST as JSON | n/a |
-O, --optimize | optimization level [default: 2] | any valid positive number |
-f, --fileform <MANIFEST_FORMAT_OVERRIDE> | override manifest format | yaml, json, polo |
-c, --codeform <BINARY_FORMAT_OVERRIDE> | override binary format | bin, asm, hex |
Test Command
coco test <module_name>
The test
command compiles and runs the module without the LogicLab utility. It executes the testcases without looking into the coco.nut
file.
Optional Flags
flag | description | supported values |
--fuel | fuel set [default: 10000] | any valid positive number |
--debug | print the opcodes of compiled functions | n/a |
--sender | sender address (you can set the sender address yourself else a new one is generated each time the command is run) | any valid address |
--debug_pisa | enable pisa debug mode | n/a |
-O, --optimize | optimization level [default: 2] | any valid positive number |