{"id":16207107,"url":"https://github.com/maifeeulasad/ucml","last_synced_at":"2026-01-20T19:32:47.443Z","repository":{"id":103265845,"uuid":"242765960","full_name":"maifeeulasad/uCML","owner":"maifeeulasad","description":"uCML (uhh-KaM-əl)","archived":false,"fork":false,"pushed_at":"2020-03-01T17:26:05.000Z","size":10,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"develop","last_synced_at":"2025-04-07T20:13:29.132Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/maifeeulasad.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2020-02-24T15:04:13.000Z","updated_at":"2020-02-25T00:15:05.000Z","dependencies_parsed_at":"2023-10-15T03:12:48.885Z","dependency_job_id":null,"html_url":"https://github.com/maifeeulasad/uCML","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/maifeeulasad/uCML","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maifeeulasad%2FuCML","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maifeeulasad%2FuCML/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maifeeulasad%2FuCML/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maifeeulasad%2FuCML/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maifeeulasad","download_url":"https://codeload.github.com/maifeeulasad/uCML/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maifeeulasad%2FuCML/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28610625,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-20T18:56:40.769Z","status":"ssl_error","status_checked_at":"2026-01-20T18:54:26.653Z","response_time":117,"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-10-10T10:10:35.622Z","updated_at":"2026-01-20T19:32:47.416Z","avatar_url":"https://github.com/maifeeulasad.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# uCML (uhh-KaM-əl)\n####      - a strictly typed static functional programming language. \n\nA baby programming language for learning principles and theories of undergrad/grad level Computer Science courses on Compilers and Principles of Programming Languages. The compiler for the uCML is implemented using FLEX, BISON and LLVM.\n\n### CFG\n```\nprogram -\u003e stmts | ϵ\n\t\t\nstmts   -\u003e stmt  | stmts stmt;\n\nstmt    -\u003e var_decl | func_decl | extern_decl  | expr   \n        | if ( expr ) block  | if ( expr ) block else block \n        | for (  id :  id in expr to expr ) block  | for (  id :  id in expr to expr by expr ) block  \n        | return expr  \n        \nblock  -\u003e { stmts } | { }  \n \nvar_decl -\u003e  id :  id  |  id :  id = expr   \n\nextern_decl -\u003e extern  id ( func_decl_args ) :  id \n        | extern id ( ) : id | extern id : id\n\nfunc_decl -\u003e def  id ( func_decl_args ) :  id =\u003e block\n        | def id ( ) :  id =\u003e block\n\nfunc_decl_args :  var_decl | func_decl_args , var_decl  \n\nexpr -\u003e  - expr | id = expr   |  id ( call_args )  | id ( ) | id  | expr % expr   | expr * expr  \n     | expr / expr   | expr +  expr   |  expr comparison expr   | expr - expr   | ( expr )   | numeric \n\nnumeric -\u003e int | double  \n\ncall_args  -\u003e expr | call_args , expr    \n\ncomparison -\u003e == | != | \u003c | \u003c= | \u003e | \u003e=\n```\n\n### Sample Codes\n\n\n#### Variable Declaration \n```ts\n x:int\n y:double = 1.0\n```\n\n#### Single Statement\n```ts\n x:int = a * 5 + 5 / 5 + (100 * 7)\n```\n\n### Function Declartion\n```ts\ndef square(x: int):int =\u003e  { return x * x }\ndef sumOfSquares(x: int, y: int):int =\u003e {\n   return square(x) + square(y)\n}\necho(sumOfSquares(4,5)) \n```\n\n### Logical Operators\n```ts\ndef comparison_test(x: int, y: int): int =\u003e { \n     echo( x == y)\n     echo( x != y)\n     echo( x \u003e= y)\n     echo( x \u003c= y)\n     echo( x \u003e y)\n     echo( x \u003c y)\n     return x \u003c y\n}\necho(comparison_test(10,10)) \n```\n\n## If-else Branching\n    if(expression) { statements } else {statements}\n\n```ts\nif(x \u003e y) {foo(x)}\nelse { bar(y) }\n```\n\n## For Loop \n    for( identifier in start to end [by step]) { statements}\n    \n```ts\nn:int = 20\np:int = 1\nfor(i:int in 1 to n) {\n    echo(p)\n    p = p + 1\n}\n\np = 1\nfor(j:int in 1 to n by 2) {\n    echo(p)\n    p = p + 1\n}\n\np = 1\nfor(k:int in n to 1 by -1) {\n    echo(k)\n}\n```\n\n## Sample IR:\n### Code\n\n```ts\n/**\n* Returns Greatest Common Divisor of @a and @b\n*/\ndef gcd(a:int, b:int):int =\u003e {\n    if(a){ // Automatic boolean casting, any nonzero becomes true.\n        return gcd(b % a, a)\n    }\n    return b\n}\n\n// Print GCD of 280 and 80; number 40 should be printed.\necho(gcd(280, 80))\n```\n### IR:\n\n```\n; ModuleID = 'main'\nsource_filename = \"main\"\n\n@.ext_print_format_lld = private unnamed_addr constant [6 x i8] c\"%lld\\0A\\00\", align 1\n@.ext_print_format_lf = private unnamed_addr constant [5 x i8] c\"%lf\\0A\\00\", align 1\n\ndeclare i32 @printf(i8*, ...)\n\ndefine internal void @echoint(i64) {\nentry:\n  %1 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.ext_print_format_lld, i32 0, i32 0), i64 %0)\n  ret void\n}\n\ndefine internal void @echodouble(double) {\nentry:\n  %1 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.ext_print_format_lf, i32 0, i32 0), double %0)\n  ret void\n}\n\ndefine internal i64 @main() {\nentry:\n  %0 = call i64 @gcd(i64 280, i64 80)\n  call void @echoint(i64 %0)\n  ret i64 0\n}\n\ndefine internal i64 @gcd(i64, i64) {\nentry:\n  %a = alloca i64\n  store i64 %0, i64* %a\n  %b = alloca i64\n  store i64 %1, i64* %b\n  %2 = load i64, i64* %a\n  %3 = icmp ne i64 %2, 0\n  br i1 %3, label %then, label %otherwise\n\nthen:                                             ; preds = %entry\n  %4 = load i64, i64* %b\n  %5 = load i64, i64* %a\n  %6 = srem i64 %4, %5\n  %7 = load i64, i64* %a\n  %8 = call i64 @gcd(i64 %6, i64 %7)\n  ret i64 %8\n\notherwise:                                        ; preds = %entry\n  br label %merge\n\nmerge:                                            ; preds = %otherwise\n  %9 = load i64, i64* %b\n  ret i64 %9\n}\n```\n\n### Code\n\n```ts\n/**\n*  Prints first @n fibonacci numbers.\n*/\ndef fibonacci(n:int):void =\u003e {\n    a:int = 0 b:int = 1 tmp:int // Semicolon, newline etc. not required, just keep any blank-space.\n    for(i:int in 0 to n){\n        echo(tmp = a) // Assign and print simultaneously.\n        a = a + b\n        b = tmp\n    }\n}\n\n// Print first 50 fibonacci numbers.\nfibonacci(50)\n```\n\n### IR:\n\n```\n; ModuleID = 'main'\nsource_filename = \"main\"\n\n@.ext_print_format_lld = private unnamed_addr constant [6 x i8] c\"%lld\\0A\\00\", align 1\n@.ext_print_format_lf = private unnamed_addr constant [5 x i8] c\"%lf\\0A\\00\", align 1\n\ndeclare i32 @printf(i8*, ...)\n\ndefine internal void @echoint(i64) {\nentry:\n  %1 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.ext_print_format_lld, i32 0, i32 0), i64 %0)\n  ret void\n}\n\ndefine internal void @echodouble(double) {\nentry:\n  %1 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.ext_print_format_lf, i32 0, i32 0), double %0)\n  ret void\n}\n\ndefine internal i64 @main() {\nentry:\n  call void @fibonacci(i64 50)\n  ret i64 0\n}\n\ndefine internal void @fibonacci(i64) {\nentry:\n  %n = alloca i64\n  store i64 %0, i64* %n\n  %a = alloca i64\n  store i64 0, i64* %a\n  %b = alloca i64\n  store i64 1, i64* %b\n  %tmp = alloca i64\n  br label %init\n\ninit:                                             ; preds = %entry\n  %i = alloca i64\n  store i64 0, i64* %i\n  br label %cond\n\ncond:                                             ; preds = %progress, %init\n  %1 = load i64, i64* %n\n  %2 = load i64, i64* %i\n  %3 = icmp sge i64 %2, 0\n  %4 = icmp sle i64 %2, %1\n  %5 = icmp sle i64 %2, 0\n  %6 = icmp sge i64 %2, %1\n  %7 = and i1 %5, %6\n  %8 = and i1 %3, %4\n  %9 = or i1 %8, %7\n  br i1 %9, label %loop, label %after\n\nloop:                                             ; preds = %cond\n  %10 = load i64, i64* %a\n  store i64 %10, i64* %tmp\n  call void @echoint(i64 %10)\n  %11 = load i64, i64* %a\n  %12 = load i64, i64* %b\n  %13 = add i64 %11, %12\n  store i64 %13, i64* %a\n  %14 = load i64, i64* %tmp\n  store i64 %14, i64* %b\n  br label %progress\n\nprogress:                                         ; preds = %loop\n  %15 = load i64, i64* %i\n  %16 = add i64 %15, 1\n  store i64 %16, i64* %i\n  br label %cond\n\nafter:                                            ; preds = %cond\n  ret void\n}\n```\n\n### Code\n\n```ts\n/* These external functions come from system shared libs */\nextern sin(a:double):double\nextern cos(a:double):double\nextern tan(a:double):double\n\necho(sin(2.345))\necho(cos(2.345))\necho(tan(2.345))\n```\n\n### IR:\n\n```\n; ModuleID = 'main'\nsource_filename = \"main\"\n\n@.ext_print_format_lld = private unnamed_addr constant [6 x i8] c\"%lld\\0A\\00\", align 1\n@.ext_print_format_lf = private unnamed_addr constant [5 x i8] c\"%lf\\0A\\00\", align 1\n\ndeclare i32 @printf(i8*, ...)\n\ndefine internal void @echoint(i64) {\nentry:\n  %1 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.ext_print_format_lld, i32 0, i32 0), i64 %0)\n  ret void\n}\n\ndefine internal void @echodouble(double) {\nentry:\n  %1 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.ext_print_format_lf, i32 0, i32 0), double %0)\n  ret void\n}\n\ndefine internal i64 @main() {\nentry:\n  %0 = call double @sin(double 2.345000e+00)\n  call void @echodouble(double %0)\n  %1 = call double @cos(double 2.345000e+00)\n  call void @echodouble(double %1)\n  %2 = call double @tan(double 2.345000e+00)\n  call void @echodouble(double %2)\n  ret i64 0\n}\n\ndeclare double @sin(double)\n\ndeclare double @cos(double)\n\ndeclare double @tan(double)\n```\n\n\n## Compilation and Running\nTo compile this program you need `flex`, `bison`, `gcc`, `g++`, `clang`, `make`, `llvm`, `zlib`, `ncurses` be installed.\n\nFor `Ubuntu` and its derivatives:\n\n```sh\nsudo apt install gcc g++ clang make flex bison llvm-dev zlib libncurses\n```\n\nFor `Fedora`, `Red Hat`, `CentOS` :\n\n```sh\nsudo dnf install flex make gcc g++ clang bison llvm-devel zlib ncurses\n```\n\nTo build, goto `src` directory and run:\n```sh\nmake build\n```\n\nTo test, goto `src` directory and run:\n```sh\nmake test\n```\n\nFor more info run:\n```sh\nmake help\n```\n\n\n\n ## Under development, we are just starting\n ### Team trash\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaifeeulasad%2Fucml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaifeeulasad%2Fucml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaifeeulasad%2Fucml/lists"}