{"id":22066246,"url":"https://github.com/modlfo/vultlib","last_synced_at":"2026-04-12T11:36:29.327Z","repository":{"id":74855075,"uuid":"84642192","full_name":"modlfo/vultlib","owner":"modlfo","description":"A node.js module providing all the functionality of the Vult compiler","archived":false,"fork":false,"pushed_at":"2023-02-25T20:56:56.000Z","size":2528,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-17T01:35:10.065Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/modlfo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-03-11T10:33:38.000Z","updated_at":"2023-08-15T16:42:18.000Z","dependencies_parsed_at":"2023-06-14T18:45:37.439Z","dependency_job_id":null,"html_url":"https://github.com/modlfo/vultlib","commit_stats":{"total_commits":56,"total_committers":1,"mean_commits":56.0,"dds":0.0,"last_synced_commit":"c663f9aa5980e5da7910f8881c8d20e5886723c5"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/modlfo%2Fvultlib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/modlfo%2Fvultlib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/modlfo%2Fvultlib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/modlfo%2Fvultlib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/modlfo","download_url":"https://codeload.github.com/modlfo/vultlib/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245145943,"owners_count":20568220,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-30T19:26:51.749Z","updated_at":"2026-04-12T11:36:29.299Z","avatar_url":"https://github.com/modlfo.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"![Vult](http://modlfo.github.io/vult/images/VultH.png?raw=true \"Vult\")\n\nA node.js module providing all the functionality of the Vult compiler. For the command line application install [vult](https://www.npmjs.com/package/vult).\n\nYou can find the full project in https://github.com/modlfo/vult\n\nTutorials and documentation can be found the main site http://modlfo.github.io/vult/\n\n# Usage\n\n```\nvar vult = require('vultlib')\n\n// Example to generate C/C++ code\nvar result = vult.generateC([{ file : 'test.vult', code : 'fun foo() return 0;' }], { output : \"Test\" });\n\n```\n\n# API\n\n### Types (description of the objects)\n\n#### Input and output files\nFiles are represented with an object containing the fields `file` and (optionally) `code`.\n```\ninput_file =\n   {\n      file : String, // required\n      code : String  // optional\n   }\n```\nFor example:\n\n```\nvar test1 = { file : 'test.vult', code : 'fun foo() return 0;' }\n```\n`test` is an input file that provides it's contents and there's no need to read it.\n\nContrary to:\n\n```\nvar test2 = { file : 'test.vult' }\n```\n\nwhen `test2` is given as input, the file `'test.vult'` will be read from the file system.\n\nThe generated code is returned in the same form:\n```\n{\n   file : \"foo.cpp\",      // File name or extension\n   code : \".. my code ..\" // Generated code\n}\n```\n\n#### Code generation options\n\nThis object is expected by all function that generate code (Js, C++, or Lua).\n```\noptions =\n   {\n      output   : String,\n      real     : String,\n      template : String,\n      includes : String Array\n   }\n```\nAll the fields are optional. For example:\n```\nvar options = { output : 'Main', real : 'fixed', includes = ['/home/leonardo'] }\n```\n\nThese options correspond to the command line options shown in [Command Line Options](https://github.com/modlfo/vult/wiki/Command-Line-Options).\n\n#### Errors\nWhen errors in the code are found they are returned in the following form:\n```\nerror =\n   {\n      msg  : String,\n      file : String,\n      line : Number,\n      col  : Number\n   }\n```\n\nFor example:\n\n\n### Methods\n\n#### version()\nReturns a string with the version of the compiler\n\n#### generateC(files, options)\n#### generateJs(files, options)\n#### generateLua(files, options)\n\nTakes an array of input files and options and generates the corresponding code.\n\nThe input and output `files` are in the form described above (`{ file : 'name'} ` or `{ file : 'name', code : '...' }`).\n\nThe `options` are described above as well.\n\nIMPORTANT: if no special options are required you need to pass an empty object `{}`.\n\nThe output will be either an array of output `file` objects or an array of errors.\n\n### Examples\n```\n// Read the file 'test.vult' and generate C code\nvar result1 = vult.generateC([{ file : 'test.vult'}], {});\n\n// Generate C code out of the given input vult code\nvar result2 = vult.generateC([{ file : 'test.vult', code : \"fun foo() return \"}], {});\n\n// Printing 'result2' will show:\nconsole.log(result2);\n/*\n[ { file: '.h',\n    code: '#ifndef VULT_H\\n#define VULT_H\\n#include \u003cstdint.h\u003e\\n#include \u003cmath.h\u003e\\n#include \"vultin.h\"\\n\\nint Live_foo();\\n\\n\\n\\n#endif // VULT_H\\n' },\n { file: '.cpp',\n    code: '#include \"Vult.h\"\\n\\nint Live_foo(){\\n   return 0;\\n}\\n\\n\\n' } ]\n*/\n\n// The input code has an error\nvar errors = vult.generateC([ { code : \"fun foo() { return 0;\", file : \"test.vult\" } ], {})\n\n// The result will be instead:\nconsole.log(errors);\n/*\n[ { msg: 'Expecting a \\'}\\' but the file ended\\nfun foo() { return 0; \\n                     ^\\n',\n    file: '',\n    line: 1,\n    col: 21 } ]\n*/\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmodlfo%2Fvultlib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmodlfo%2Fvultlib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmodlfo%2Fvultlib/lists"}