{"id":26696219,"url":"https://github.com/vmfmyot/kawa-interpreter","last_synced_at":"2025-03-26T20:18:14.000Z","repository":{"id":284495107,"uuid":"944750080","full_name":"vmfmyot/Kawa-Interpreter","owner":"vmfmyot","description":"Compilation uni project about building an interpreter for a small object-oriented language","archived":false,"fork":false,"pushed_at":"2025-03-26T06:28:28.000Z","size":27,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-26T07:29:50.184Z","etag":null,"topics":["compilation","functional-programming","object-oriented-programming","ocaml"],"latest_commit_sha":null,"homepage":"","language":"OCaml","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/vmfmyot.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":"2025-03-07T22:37:31.000Z","updated_at":"2025-03-26T06:37:57.000Z","dependencies_parsed_at":"2025-03-26T07:39:54.177Z","dependency_job_id":null,"html_url":"https://github.com/vmfmyot/Kawa-Interpreter","commit_stats":null,"previous_names":["vmfmyot/kawa-interpreter"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vmfmyot%2FKawa-Interpreter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vmfmyot%2FKawa-Interpreter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vmfmyot%2FKawa-Interpreter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vmfmyot%2FKawa-Interpreter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vmfmyot","download_url":"https://codeload.github.com/vmfmyot/Kawa-Interpreter/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245727761,"owners_count":20662558,"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":["compilation","functional-programming","object-oriented-programming","ocaml"],"created_at":"2025-03-26T20:18:13.338Z","updated_at":"2025-03-26T20:18:13.989Z","avatar_url":"https://github.com/vmfmyot.png","language":"OCaml","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Kawa Interpreter\n\nThis project provides an OCaml interpreter for 'Kawa', a small object-oriented language.\\\nDeveloped in 4 weeks for a 3rd-year university compilation course, it covers both syntax and semantics.\n## Authors\n\nThis project was made by [Isabel Fabrega](https://github.com/im-f) and [Victoria Myot](https://github.com/vmfmyot), computer science students at Université Paris-Saclay.\n\n## Prerequisites\n\nAs this project is written in OCaml, we recommend you have opam installed on your machine. Here's the [link](https://opam.ocaml.org/) to the installation page.\n\n## Documentation\n\nKawa is a small object-oriented language inspired by Java. However, we adapted some of the features for an easier implementation.\\\nKawa files have the `.kwa` extension. You can find some examples in the tests folder.\\\n\\\nTo compile and execute a file, use the following command line :\\\n`./kawai.exe \u003cname_of_file\u003e`\\\n**Variables** need to be declared at the beginning of a file. They can either be declared one by one, or one after the other if they are of the same type. **Classes** are declared below variables. The **main code** is executed in a `main { }` function (without the () !)\\\nComments can be detected with `//`.\n\\\nYou will find down below the different features available.\n\n\n\n### _Basic types_\nThis Kawa interpreter supports the following types : integer with the keyword `int`, strings with either `string` or `char` and booleans with `bool`.\\\n\\\n**Sidenote on strings :**\\\nStrings can be concatenated with the binary operator `@`.\\\nStrings are treated as arrays of single characters : the length of a string is returned by the `.length` function, and `val[index]` returns the character at the given index (as long as val is a string).\n\n\n### _Binary operators_\nThe usual binary operators are implemented :\n- Computational operators: `= + - / %`\n- Comparison operators: `\u003c \u003c= \u003e \u003e= == !=`\n- Boolean operators: `\u0026\u0026 ||`\nWe also added structural equality, which check if 2 objects are structurally equal. The binary operators for this are `===` and `=/=`.\\\nStructural equality is tested in the `eqstruct.kwa` file.\n\n\n### _Print function_\nIntegers and strings can be printed with the `print(parameters)` function.\n\n### _Inheritance_\nTo let a class inherit from another, the keyword `extends` can be used the exact same way as in Java.\\\nConstructors can be made with the keyword `super` to call on the constructor of the parent class the following way : `super.constructor(parameters here)`.\\\nInheritance is tested in the `extend.kwa` file.\n\n### _Instanceof and typecast_\nKeyword `instanceof` and typecasting are just like in Java, and tested in the `extrafonctions.kwa` file.\n\n\n### _Loops_\nThis interpreter supports if, while and for loops.\n- IF : `if( condition ){ instructions }`\n- WHILE : `while( condition ){ instructions }`\n- FOR : `for( type variable ; condition ; variation ){ instructions }`\n\n\n**while** and **if** loops are tested in the `instr.kwa` file, and **for** loops in `loops.kwa`.\\\n\\\nThere are also **foreach loops**, currently only usable on arrays as they're the only iterable structure :\\\n`for( array_type value : name ){ instructions }`\\\n**foreach** loops are tested in `tab.kwa`.\n\n\n### _Override_\nOverriding functions is allowed, and overrides are tested in `extrafonctions.kwa`.\n\n\n### _Arrays_\nSimple arrays are supported, with the [ ] token.\\\n\\\n**Declaration :** `type_of_array[] name_of_array`\\\n\\\n**Initialization :** there are 2 possible ways of initializing an array :\n```\narr1 = new type[]\narr2 = [element1, element2, element3]\n```\nArrays also have the following methods :\n- `.length` : returns the length of an array\n- `.hd` : returns the 1st element of an array\n- `.tl` : returns the last element and removes it out of the array\n- `.rem(index)` : removes the element of the given index\n- `.mem(value)` : returns true if the value is in the array, else returns false\n- `.copy` : returns a copy of the array\n\nArrays are tested in the `tab.kwa` file.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvmfmyot%2Fkawa-interpreter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvmfmyot%2Fkawa-interpreter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvmfmyot%2Fkawa-interpreter/lists"}