-
Notifications
You must be signed in to change notification settings - Fork 10
Languages
To execute any file (main solution, generator, brute solution, ...), acmX looks for the extension of the source code, and tries to find a definition of this extension in ~/.acmx/languages
. This folder contains several json files with precise information about how to compile and run each type of extension.
Each json file contains the definition for one language. It is a dictionary with three values:
{
"preRun": [],
"run": [],
"ext": ""
}
-
preRun
: Command line to execute to compile the source code. If it is omitted or empty, the source code won't be compiled. -
run
: Command line to execute the source code. -
ext
: String with the extension it is giving support to.
There are available several flags that can be used on the commands:
- $CODE: Path to the file with the source code.
- $OUTPUT: Path to the "binary" that is going to be generated. (If any).
-
$ATTIC: Path to
attic
of current folder. This might be useful to generate all trash files that are generated some times.
Refer to examples below.
Note that it is possible to add different definitions for py
, py2
, py3
extension. It can be used to detect proper Python Interpreter to be used from the extension.
This is the list of supported languages with their default compile/run command lines. They can be edited at ~/.acmx/languages
{
"preRun": [
"g++",
"-fdiagnostics-color=always",
"-std=c++17",
"-DACMX",
"$CODE",
"-o",
"$OUTPUT",
"--debug"
],
"run": ["$OUTPUT"],
"ext": "cpp"
}
{
"preRun": [],
"run": ["python", "$CODE", "DACMX"],
"ext": "py"
}
Not supported by default yet.
Not supported by default yet.
To give support for a new language (or for different compiler or interpreter version) create a json file in ~/.acmx/languages
following the rules defined at the beginning. Define compile command (if required) and run command. Use the flags
The ext
should be different to all other defined ext
in that folder, to avoid collision, otherwise it is undefined which definition will be used when acmX tries to compile a run a source file.
It is possible to use languages that requires several files to be created in the workspace. Read about templates.
languages
folder is located under homePath defined at settings acmx.configuration.homePath. Its default value is ~/.acmx
. That is the reason, we use ~/.acmx/languages
as the default value for the folder containing language definitions.
acmX 2020 Post any error or question in the main issue tracker or join Telegram group