{"id":18853963,"url":"https://github.com/janbar/bloc","last_synced_at":"2026-04-29T15:01:16.094Z","repository":{"id":148844927,"uuid":"591728624","full_name":"janbar/BLOC","owner":"janbar","description":"A modular interpreter based on PL syntax","archived":false,"fork":false,"pushed_at":"2026-02-25T22:53:36.000Z","size":3309,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-26T01:17:35.534Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/janbar.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-01-21T17:20:38.000Z","updated_at":"2026-02-25T22:53:40.000Z","dependencies_parsed_at":"2023-07-06T19:01:55.362Z","dependency_job_id":"8e5a0150-00e9-406f-b92a-238d45de59dd","html_url":"https://github.com/janbar/BLOC","commit_stats":null,"previous_names":[],"tags_count":36,"template":false,"template_full_name":null,"purl":"pkg:github/janbar/BLOC","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janbar%2FBLOC","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janbar%2FBLOC/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janbar%2FBLOC/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janbar%2FBLOC/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/janbar","download_url":"https://codeload.github.com/janbar/BLOC/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janbar%2FBLOC/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29872686,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-26T21:05:00.265Z","status":"ssl_error","status_checked_at":"2026-02-26T20:57:13.669Z","response_time":89,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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-08T03:46:13.117Z","updated_at":"2026-02-26T21:08:00.641Z","avatar_url":"https://github.com/janbar.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![coverity-scan status](https://scan.coverity.com/projects/32648/badge.svg)](https://scan.coverity.com/projects/janbar-bloc)\n[![build-ubuntu](https://github.com/janbar/BLOC/actions/workflows/build-ubuntu-latest.yml/badge.svg)](https://github.com/janbar/BLOC/actions/workflows/build-ubuntu-latest.yml)\n[![build-macos](https://github.com/janbar/BLOC/actions/workflows/build-macos.yml/badge.svg)](https://github.com/janbar/BLOC/actions/workflows/build-macos.yml)\n[![build-windows](https://github.com/janbar/BLOC/actions/workflows/build-windows.yml/badge.svg)](https://github.com/janbar/BLOC/actions/workflows/build-windows.yml)\n\n# BLOC\nA modular interpreter based on PL syntax.\n\nBLOC can be used as is or embedded in a C/C++ program to perform dynamic processing. The language is of the PASCALIAN type, therefore easy to learn. You can extend functionality by dynamically importing modules (object). Samples of module are \"file\", \"date\", \"utf8\", \"sqlite3\", or \"plplot\" that allows to operate others types. See [modules](./modules/).\n\nThe syntax of the language is extremely readable, which avoids misunderstandings and design ambiguities.\nThe declaration and execution of functions are confined in their own context.\nInternally, BLOC supports scalar data types like boolean, integer, decimal, string, byte array, and compound types like complex, tuple and table. See the [Reference Manual](./docs/BLOC-Reference-Manual.md) for concepts and details.\nFor now, it processes twice as fast as Python and Lua, and twenty as fast than Perl.\n\nIt is my common scripting language, running secure, fast, and as same on all platforms (MS-Windows, Linux, BSD, MacOS, Illumos, SunOS).\nBy using the modules SQLite3, MariaDB, or Oracle, it interoperates natively with a database.\nAnd by using the modules sys, file, date, it makes it a powerful scripting language for everyday processing.\nFinally, it is my powerful calculator, and my replacement for the farmer *bc* or *expr*.\n\n## Install BLOC\nUbuntu packages are available in the repository `ppa:jlbarriere68/bloc`. You can install BLOC on Ubuntu by the following:\n```\nsudo add-apt-repository ppa:jlbarriere68/bloc\nsudo apt-get update\nsudo apt-get install bloc bloc-module-*\n```\nFor other OS, please check if there is an artifact on the release page, otherwise you need to build it yourself.\n\n## Build BLOC\nYou can build and test BLOC on Unix (Linux, BSD, MacOS, Illumos, SunOS), and MS-Windows. This repository contains the CMake project to configure and build BLOC. To achieve the build you will need to install **cmake** and a C99/C++11 compiler (**GCC** or **CLang**).\n\nThe build provides the core library **blocc**, the CLI tool **bloc**, and some modules to extend types and features of the language.\n\n```\ncmake -B release -DCMAKE_BUILD_TYPE=Release\ncmake --build release\ncmake --build release --target test\ncmake --build release --target install\n```\n\nAt least the modules **file**, **date**, **csv**, **utf8** and **sys** don't require external dependencies, and so they are made with the core library.\nTo enable the build of the others modules **sqlite3**, **mariadb** and **plplot**, prior you have to install and configure the dependencies.\n\n## Run the CLI\nLaunch **bloc** and type \"help\".\n\nYou could type inline expression as shown below.\n```\n = sqrt( sin(3*pi/4) ** 2 + cos(3*pi/4) ** 2 )\n```\nOr run a sample script as follow.\n```\nfor I in 2 to 100000 loop\n    for J in 2 to int(sqrt(I) + 1) loop\n        if (I % J) == 0 then\n            break;\n        end if;\n    end loop;\n    if J \u003e sqrt(I) then\n        print I;\n    end if;\nend loop;\n```\nAnd create your customized function.\n```\nfunction split(buf, delim, trimnull:boolean) return table is\nbegin\n  t = tab(0, str()); /* The strongly typed table will be returned */\n  p = 0; /* The current position in buf */\n  s = delim.count();\n  while true loop /* Or use limit: for i in 1 to 256 loop */\n    n = strpos(buf,delim,p);\n    if isnull(n) then\n      break;\n    end if;\n    t.concat(substr(buf,p,n-p));\n    p = n+s;\n    while (trimnull and strpos(buf,delim,p) == p) loop\n      p=p+s;\n    end loop;\n  end loop;\n  if not trimnull or p \u003c buf.count() then\n    t.concat(substr(buf,p));\n  end if;\n  return t;\nend;\n\nfunction split(buf, delim) return table is begin\n  return split(buf,delim,false);\nend;\n\nfunction split(buf) return table is begin\n  return split(buf,\" \",true);\nend;\n\n\nforall e in split(\"abcd  1234 efgh   6789 \") loop print e; end loop;\n```\nLearn more about typing:\n`help type`, `help statement`, `help builtin`, `help operator`, or `help` + *keyword*.\n\nThe example to follow uses the complex type (ii) to calculate Z of a Low Pass Filter order 2 (LC) loaded by a resistor R.\n```\nL = 1.8e-3; /* 1.8mH */\nC = 14e-6;  /* 14uF */\nR = 8;      /* 8R */\n\nF = 31.5;   /* from band 0 i.e 31.5 hz */\nwhile F \u003c 20000 loop /* to band 9 */\n  ZC = 1 / ( 2 * pi * F * C * ii );\n  ZL = 2 * pi * F * L * ii;\n\n  Z = ZL + ( R * ZC / ( R + ZC ) );\n\n  print \"Freq: \" round(F,1) \"\\tZ: \" imag(Z) \"\\tPhase: \" 180 * iphase(Z) / pi;\n  f = f * 2; /* loop next band */\nend loop;\n```\nNote that the constant `ii` allows us to naturally construct a complex number.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjanbar%2Fbloc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjanbar%2Fbloc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjanbar%2Fbloc/lists"}