eolang
v0.34.1
Published
A collection of command line tools for EOLANG: compiling, parsing, transpiling to other languages, optimizing, and analyzing
Downloads
270
Maintainers
Readme
EOLANG Command Line Tool-Kit
This is a command-line tool-kit for EO programming languages, allowing you to compile EO programs, test, dataize, and check for errors.
First, you install npm and Java SE.
Then, you install eolang package, using npm:
npm install -g [email protected]You can also use Homebrew (on macOS):
brew tap objectionary/eoc https://github.com/objectionary/eoc
brew install objectionary/eoc/[email protected]Or install it via Nix flakes:
nix run github:objectionary/eoc{
inputs = {
eoc.url = "github:objectionary/eoc";
nixpkgs.url = "github:nixos/nixpkgs/nixos-25.05";
};
outputs = { self, nixpkgs, eoc, ... }: {
nixConfigurations.<hostname> = nixpkgs.lib.nixosSystem {
modules = [
{
nixpkgs.config.packageOverrides = pkgs: {
eoc = eoc.packages.${system}.default;
};
}
];
}
};
}After that, select one of the methods for installing the package:
#configuration.nix (Global)
{
environment.systemPackages = with pkgs; [
eoc
];
}#configuration.nix (For user)
{
users.users.<your-user-name>.packages = with pkgs; [
eoc
];
}#home.nix (For home-manager)
{
home.packages = with pkgs; [
eoc
];
}Then, you write a simple EO program in hello.eo file
in the current directory:
# My first object in EO!
[args] > hello
QQ.io.stdout > @
"Hello, world!\n"Then, you run it:
eoc --easy dataize helloThat's it.
Commands
You can also do many other things with eoc commands
(the flow is explained in this blog post):
registerfinds necessary.eofiles and registers them in a JSON catalogassembleparses.eofiles into.xmir, optimizes them, and pulls foreign EO objectstranspileconverts.xmirfiles to the target programming language (Java by default)compileconverts target language sources (e.g.,.java) to binaries (e.g.,.class)linkputs all binaries together into a single executable binarydataizedataizes a single object from the executable binarytestdataizes all visible unit testslintfinds style-related errors in EO and XMIR filesjeo:disassembleconverts Java.classfiles to.xmir(via jeo)jeo:assembleconverts.xmirfiles to Java.classfiles (via jeo)
There are also commands that help manipulate with XMIR and EO sources (the list is not completed, while some of them are not implemented as of yet):
auditinspects all required packages and reports their statusforeigninspects all objects found in the program after theassemblestepsodggenerates.sodgfrom.xmir, further rederable as XML or Dotprintgenerates.eofiles from.xmirfilesgenerate_commentsgenerates.jsonfiles with LLM-generated documentation for.eostructuresdocsgenerates HTML documentation from.xmirfileslatexgenerates.texfiles from.eosourcesfmtformats.eofiles in the source directory- ~~
translateconverts Java/C++/Python/etc. program to EO program~~ - ~~
demuremovescageandmemoryobjects~~ - ~~
dejumpremovesgotoobjects~~ - ~~
infersuggests object names where it's possible to infer them~~ - ~~
flattenmoves inner objects to upper level~~
This command line toolkit simply integrates other tools available in the @objectionary GitHub organization.
Linting
There are two ways to work with linting. The --easy option enables linting
but ignores warnings, while the --blind option completely disables linting.
How to Test
To execute the project tests, use the following command:
npx gruntThis command will run all the testing steps, including tests, linting, coverage, and more. If you only need to run the tests, use:
npm testTo run a specific test based on its description, use the following command:
npm test -- --grep="<test-description>"For example, to run a test with the description "formats EO files according to expected patterns," execute:
npm test -- --grep="formats EO files according to expected patterns"You can also run a specific test file using npx grunt:
npx grunt --file=test/commands/test_fmt.jsHow to Contribute
First, run npm install.
Make your changes, run tests and then
make
a pull request.
