{"id":19784325,"url":"https://github.com/alexprut/sca-lang","last_synced_at":"2025-06-28T20:02:29.925Z","repository":{"id":67790701,"uuid":"52871337","full_name":"alexprut/sca-lang","owner":"alexprut","description":"Project a suitable abstract syntax similar to Scala language, and write in Haskell a compiler for the new engineered language.","archived":false,"fork":false,"pushed_at":"2020-06-08T17:28:55.000Z","size":182,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-11T02:49:18.146Z","etag":null,"topics":["compiler","engineered-language","haskell","parser"],"latest_commit_sha":null,"homepage":"","language":"Haskell","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/alexprut.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":"2016-03-01T11:18:53.000Z","updated_at":"2023-01-19T22:21:11.000Z","dependencies_parsed_at":null,"dependency_job_id":"fd15d52c-3759-452a-a369-77a66df33818","html_url":"https://github.com/alexprut/sca-lang","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexprut%2Fsca-lang","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexprut%2Fsca-lang/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexprut%2Fsca-lang/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexprut%2Fsca-lang/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alexprut","download_url":"https://codeload.github.com/alexprut/sca-lang/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241117061,"owners_count":19912473,"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":["compiler","engineered-language","haskell","parser"],"created_at":"2024-11-12T06:11:11.590Z","updated_at":"2025-02-28T07:17:50.292Z","avatar_url":"https://github.com/alexprut.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"Sca Language\n=================\nProject created during my Master's Degree in Computer Science for the _Languages and Compilers_ class.\n\n_(please do not judge the code quality, it was written in 1 week of rush and hurry)_\n\n\n-----------------\n\n\n#### Project Goals\nProject a suitable abstract syntax similar to [Scala](http://www.scala-lang.org/) language, and write in [Haskell](https://www.haskell.org/) a compiler for the new engineered language.\n\n#### Sub-Goals\n* Project an Abstract Syntax \n* Type-System\n* Lexer (using [Alex](https://www.haskell.org/alex/))\n* Parser (using [Happy](https://www.haskell.org/happy/)) \n* Type-Checker\n* [Three-address code](https://en.wikipedia.org/wiki/Three-address_code) (intermediate code generation)\n\n#### Usage\nType and run from you terminal `make demo`, it will automatically create a demo.\nOr simply run `./Compiler filename.sca` to compile the source code from `filename.sca`, there is also a verbose debug mode: `./Compiler -d filename.sca`.\n\n\n#### Sca language syntax\n```scala\n// Basic Declaration\nvar k: Boolean = ! true;\nvar w: Boolean = (1 \u003c= 5) \u0026\u0026 (true || false); \nvar c: Char = 'c';\nvar c: Int = -1;\nvar x: Int = 5 + 6;\nvar y: Int = 5 * 4;\nvar z: Int = 5 / 4;\nvar p: *Int = \u0026c;\nvar kk: *Int = p;\nvar zza: Float = 5.0;\nvar zzzz: Int = zza;\n\n// Compound Declaration\nvar s: Array[Array[Char](2)](2) = Array(Array('a', 'b'), Array('a', 'b'));\nvar i: Array[Array[Int](2)](2) = Array(Array(1+2,3), Array(5+3/7,1));\nvar a: Boolean = true;\n\ndef proc(valres c: Int, b: Boolean): Int = {\n    return (c);\n}\n\n// Function Declaration\ndef func(a: Int, b: Boolean, d: Char, n: Float, l: Boolean, m: Array[Array[Char](2)](2)): Int = {\n    // Basic Declaration\n    var counter: Int = a;\n    var z: Int = proc(counter, b);\n    zza = 5;\n    counter = a;\n    counter += a;\n    x = ++x + x;\n\n    // Iteration Statement\n    while (b == true) {\n        // Function Call\n        var z: Int = proc(counter, b);\n        break;\n        continue;\n        proc(counter, b);\n    }\n\n    // Selection Statement\n    if ((10 \u003e= 8) || (counter \u003e 5)) {\n        var counter: Int = 2;\n    } else {\n        var counter: Int = 4;\n    }\n\n    if ((!true) || (counter \u003e 5)) {\n        var counter: Int = 2;\n    }\n\n    // Left Expression Declaration\n    ++counter;\n    --counter;\n\n    // Primitive function call\n    writeInt(a);\n\n    x = readInt(\"anything\");\n\n    x = ++(++x) + ++x;\n    x = ++x + x;\n    y-- = x-- - ++x--;\n    y-- = x;\n    y++;\n\n    s[1][2];\n    d = s[1][1];\n    s[1][0] = 'a';\n\n    *p = 5;\n\n\n    for (c \u003c- 1 to 10){\n        c = 5;\n        if (x\u003e5) {\n            x++;\n        }\n        \n        continue;\n        break;\n    }\n\n    // Try Catch\n    try {\n        x=5;\n    } catch {\n        case ex: Exception =\u003e {\n\n        }\n    }\n\n    // Jump Statement\n    return (1+1);\n}\n\ndef main(): Unit = {\n    val z: Int = func(1, true, 'a', 3, false, s);\n    return;\n}\n\n// Program execution\nval run: Unit = main();\n```\n\n\nLicense\n-------\nDo whatever you want to.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexprut%2Fsca-lang","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falexprut%2Fsca-lang","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexprut%2Fsca-lang/lists"}