{"id":15564639,"url":"https://github.com/chovanecm/pascal-truffle","last_synced_at":"2025-03-29T05:14:12.597Z","repository":{"id":138584019,"uuid":"76572777","full_name":"chovanecm/pascal-truffle","owner":"chovanecm","description":"Pascal language for Truffle","archived":false,"fork":false,"pushed_at":"2018-04-18T05:12:22.000Z","size":166,"stargazers_count":1,"open_issues_count":2,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-02-03T14:49:34.331Z","etag":null,"topics":["ctu-fit","graalvm","java","jvm","jvm-languages","oracle","pascal","pascal-language","truffle"],"latest_commit_sha":null,"homepage":null,"language":"Java","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/chovanecm.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":"2016-12-15T15:43:38.000Z","updated_at":"2024-01-13T23:56:08.000Z","dependencies_parsed_at":"2023-04-15T12:00:49.720Z","dependency_job_id":null,"html_url":"https://github.com/chovanecm/pascal-truffle","commit_stats":{"total_commits":67,"total_committers":3,"mean_commits":"22.333333333333332","dds":"0.31343283582089554","last_synced_commit":"1f338b3656bdcab42e3b85b5ea20831f4a1b3ac2"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chovanecm%2Fpascal-truffle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chovanecm%2Fpascal-truffle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chovanecm%2Fpascal-truffle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chovanecm%2Fpascal-truffle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chovanecm","download_url":"https://codeload.github.com/chovanecm/pascal-truffle/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246140592,"owners_count":20729802,"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":["ctu-fit","graalvm","java","jvm","jvm-languages","oracle","pascal","pascal-language","truffle"],"created_at":"2024-10-02T16:41:30.912Z","updated_at":"2025-03-29T05:14:12.577Z","avatar_url":"https://github.com/chovanecm.png","language":"Java","readme":"# Pascal in Truffle\n\nThis project implements a subset of Pascal language by Niklaus Wirth from the Swiss Federal Institute of Technology in Zürich (aka ETH Zürich).\n\nIt uses Oracle's [Truffle](http://www.oracle.com/technetwork/oracle-labs/program-languages/overview/index-2301583.html) to achieve higher performance by allowing just-in-time compilation of the interpreted Pascal code.\n\n## Features\n\nThe language (should) support:\n\n- only the \"main\" procedure (no user-defined functions or procedures)\n- integer, real, boolean and string variables\n- static 1-D arrays of integers, real, boolean and string defined by `[from..to]` range.\n- write and writeln (no read, no readln)!!!\n- +, -, *, /, div\n- if, while, for ... to and for ... downto\n- and, or, not\n- \u003c, \u003e, \u003c=, \u003e=, \u003c\u003e, =\n\n## Dependencies\n\n- [GraalVM JDK 0.20](http://www.oracle.com/technetwork/oracle-labs/program-languages/downloads/index.html)\n\nGraalVM JDK must be installed in the `graalvm` directory under the root of the project.\n\n## Build\n\nRun mvn package in the pascal-truffle directory.\n\nJDK_HOME must be set to graalvm, then run mvn package.\n\t\n\tmvn package\n\n## Run\n\n\t./run-pascal benchmark/bubble.pas -time\n\t\nThe code above runs bubble sort on 10000 numbers and prints the time needed to execute the code (without time needed to start the Java Virtual Machine).  \nThere is one additional benchmark in the directory. \n\nCode can be entered using the standard input as well.\n\n## Performance Tests\n\nDuring the development, some of the Truffle features were incrementally added. \nThe respective versions are [tagged](https://github.com/chovanecm/pascal-truffle/releases) and described in the repository.\n\n### Versions\n- FreePascal: program compiled using fpc\n- v0.2 - pascal-truffle with the Truffle API and no optimisations. Often uses \"slow operations\" (interpreter mode)\n- v0.3 - pascal-truffle - avoiding slow operations by preallocating FrameSlots\n- v0.4 - pascal-truffle - uses RepeatingNode to speed up loops.\n\nThe following table shows the time needed to execute respective programs.\n\n| Program name   | FreePascal (s) | pascal-truffle v0.2(.1)  (s)| pascal-truffle v0.3  (s) | pascal-truffle v0.4 (s) |\n|---|---|---|---|---|\n| Collatz  | 2,1  | 168  | 90  | 3,15  |\n| Bubble  | 0,225  | 30  | 19,5  | 5,04  |\n\n### About the Programs\n\n#### Collatz\nCollatz computes the Collatz sequence of given natural number *n*. The successor of *n* is *n/2* for even numbers and *3n+1* for odd numbers until reaching *1*. This is repeated many times to heat the virtual machine up.\n\n#### Bubble\nBubble is a bubble sort implementation running on 10 000 numbers in an array. It requires many memory access operations, including access to the array. Unlike *Collatz*, it doesn't repeat the program itself many times. Therefore, the virtual machine is not as heated up as in the previous program. When repeating the program 10 times, the sorting is in average about 25 % faster than the signle-pass version.\n\n## Acknowledgements\n- A big thanks to Karel Rank, who allowed me to use his older work, [Pascal Parser](https://github.com/karl82/pascal-interpreter), as my starting point.\n- [Jakub Podlešák](https://github.com/japod) from Oracle for his tutorial session at the Czech Technical University and providing me with further materials on Truffle\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchovanecm%2Fpascal-truffle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchovanecm%2Fpascal-truffle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchovanecm%2Fpascal-truffle/lists"}