{"id":21326935,"url":"https://github.com/eshaancoding/velvaprogramminglanguage","last_synced_at":"2025-03-16T00:12:20.371Z","repository":{"id":164873693,"uuid":"564490115","full_name":"Eshaancoding/VelvaProgrammingLanguage","owner":"Eshaancoding","description":"we are creating a programming language for some reason.","archived":false,"fork":false,"pushed_at":"2023-08-14T14:43:42.000Z","size":1054,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-22T12:45:31.424Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C","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/Eshaancoding.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":"2022-11-10T20:41:47.000Z","updated_at":"2023-08-04T19:53:06.000Z","dependencies_parsed_at":null,"dependency_job_id":"fc7441cf-40b5-44b4-814e-c2be8f77a48e","html_url":"https://github.com/Eshaancoding/VelvaProgrammingLanguage","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/Eshaancoding%2FVelvaProgrammingLanguage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Eshaancoding%2FVelvaProgrammingLanguage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Eshaancoding%2FVelvaProgrammingLanguage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Eshaancoding%2FVelvaProgrammingLanguage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Eshaancoding","download_url":"https://codeload.github.com/Eshaancoding/VelvaProgrammingLanguage/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243806072,"owners_count":20350775,"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":[],"created_at":"2024-11-21T21:12:25.739Z","updated_at":"2025-03-16T00:12:20.349Z","avatar_url":"https://github.com/Eshaancoding.png","language":"C","readme":"# Velva Programming Language\n\nThe Velva Programming Language is a low-level programming language designed for extensibility, friendly syntax, and equipped with plenty of useful libraries.\n\n## Todo:\n\n* Assign string??? idk how that works\n\t* escape characters like \\n support\n\n* Check if scoping really works\n\t* what if you declare two variables in a different scope?\n\t* Check whether overloaded functions (both in classes and outside classes) work\n\t* what if an argument to the function and then the same name is redeclared :(\n\n* types within types (classses within classes and accessors for those)\n\t* this is where you have to create one big giant GEP instruction\n\n* add string stdlib\n\n* better error management (search for throw invalid argument and then go from there)\n\n* linter (treesitter)\n* intellisense (microsoft language server protocol (LSP), not sure how to implement that)\n\n* multiple files \n\t* Ig you can call `ld` and `clang` temporaily but one day you have to make it into a c interface one day you know\n\n* better error messages\n* enums, structs \n\n* [more complex escape chars](https://en.cppreference.com/w/cpp/language/escape)\n\n========================================================\n* Create a full or auto diff / neural network then :0\n========================================================\n* Class Inheritance (Polymorphism)\n\n## Tests\n\nOnce you successfully generate build files using the `cmake` command and executable `veld` (more instructions on \"How to build manually?\"), you could look at all the tests that Velva is currently passing.\n\nThe tests are at the `tests` folder of this repo. Almost all of .vld are then checked with the `ctest` command that is set up in the `CMakeLists.txt`\n\n## Goals\n\n* Speed comparable to C++.\n* Friendly Syntax\n* Automatic Differentiation Library\n* Communications Library (UCP/TCP protocol, etc.)\n* Strongly-typed\n* Friendly and easy-to-understand error messages\n\n## How to run?\n\n* You could go to the Releases tab and select your operating system. \n    * Our website is [here](https://www.google.com/search?q=nonexistent+programming+language+website).\n\n## How to build manually?\n\n1. Create the tree sitter cli via going to the `src/TreeSitter` directory and run `npm install`  (\u003c--- TODO: Maybe add this in CMake later)\n2. Add `src/TreeSitter/node_modules/tree-sitter-cli/` to path, this will generate the CLI needed for generating the tree sitter source code\n3. In the `src/TreeSitter` directory, run `tree-sitter generate`\n4. make a `build` folder in the `VelvaProgrammingLang` directory (`mkdir build`) and go into it (`cd build`)\n5. Run `cmake -G [Generator of Your Choice] ../`\n    * The generator can be Unix Makefiles, Ninja, Visual Studio, or any other (you could check your available options by typing `cmake --help`)\n    * Recommended is Ninja, since it has default parrallel-worker support (faster).\n6. Then build the program using `make`, `ninja`, etc. (depends on the generator of your choice) \n7. Use `veld main.vtk` to run the program\n\n## Why are we doing this?\n\n* We don't know\n* Why Beshaan is doing this: because he's bored of machine learning and frontend development from time to time\n    * He also likes C++ a lot and always wanted to make a big project out of it.\n    * He also wants to learn from Daniel D'Silva about low-level programming stuff.\n\n## How long will this take? \n\n* Like forever.\n* No seriously. Like forever\n\n## Target Syntax:\n\n```\n//This is a comment\n/* This is a multi-\nline\ncomment */\n\nptr\u003cint\u003e hello = x\nhello[0]  // eval to x\n*hello    // eval to x\nhello[1]  // if \n\nref\u003cint\u003e x\n\nprint(\"Hello World\") //Prints Hello World\n\n//The declaration of write is as follows:\nfunc print(string s, /* omitted for now */)\n\n//Writing our own function:\npure sum(int a, int b) -\u003e int {\n\treturn a+b\n}\n\n//The above function adds two integers (I know it's so complicated)\n//You will notice that `write` is declared with \u003c\u003cfunc\u003e\u003e while our own function is declared with \u003c\u003cpure\u003e\u003e\n//The difference is that pure functions cannot:\n// * Call any non-pure function\n// * Store state\n//This enables the compiler to optimize better if it knows there are no side effects — for instance, it can compute functions at compile time if it can\n\\\nvar variable = 3\nprint(“hello, your is ${variable}”)\nint variable = 3 //Compiler type specification\nconst ls = [2, 3]\nls = [1, 2] //ERROR: vals can only be mutated by the object\n\nvariable.append(2) //ERROR: Nothing can mutate the class\n\n// fixed arr length\nconst int[3] arr = [3,2,3]; \n\n\n// Demonstration of constructor and stuff.\nclass ClassFive {\n\tprivate int x;\n\tprivate char y;\n\n\tconstruct (int x, char y) : x(x), y(y); // \u003c-- it now sets each of the private variables to the parameters.\n}\n\n// Class ClassOne\nclass ClassOne {\n(public get, private get set, protected get set) {\n\tint x {\n\t\tget { return 3 }\n\t\tset { print(\"Set to ${$0}\") }\n\t}\n\tint y = 3 {\n\t\tdidset { print(\"did set y to ${y}\") }\n\t}\n\t\t\n}\n\n// Static variables that could been seen across all objects\nstatic (public get, private get set) {\n\tint global variable\n}\n\npublic {\nint i = 3\n}\n// Constructor\n\tconstruct () {\n\t\tprint(\"papa jaime HI THANKS FOR INVITING ME TO YOUR PROJECT DANIEL\")\n\t}\n\n// deconstruct \n\ndestruct () {\n\t//Members are destroyed after destructor is run\n}\n\n// a function that doesn’t return anything\nfunc addToResult (int a, int b)  {\n\tself.result = a + b;\n}\n\n// Only can read the result\n\tpure justReadAdd (int a, double b) {\nself.result = 3 // ERROR!!!!\t\t\n\t\treturn a + b + self.result; // No error! It can read.\n}\n}\n\nclass ClassTwo -\u003e ClassOne {\n\tfunc \n}\n\nextend ClassOne {\n\tpure inc(int a) {\n\t\treturn a + 1\n\t}\n}\n\n// Adds a new method to the class\n\n\n// In another file.\nimport “/HelloWorld.stk”\n\n\n// Example\nclass ClassOne {\n\tprivate {\n\t\tint gears = 3;\n}\nfunc getGears () -\u003e int {\n\treturn gears;\n}\n}\n\nclass ClassTwo {\n\tfunc printGearClassOne (ClassOne obj) {\n\t\tprint(obj.getGears());\n\t}\n}\n\n// If statements\nint x = 3\nif (x == 3) { x = 5 }\nif (y == 2) {y = 6; x = 2} \n\nwhile (x \u003e= 3) { x -= 5 }\n\nconst array = [1,2,3,4,5];\nfor (int i : array) {\n\t// do stuff\n}\n\nfor (int i = 0; i \u003c 3; i++) {\n\t// No one cares about you.\n}\n\n\n// Data structures, use only tensor\n\n// array\n\nint myTensor = tensor\u003ctype\u003e(dimension); // arguments with dimensions of the \n// one dimension makes array, other dimension can be fixed\n\n// 2d array\nint myMat = tensor\u003ctype type\u003e(dimension, dimension); // matrix\n\n// 1d array\ntensor array = [2.3,4.2]\n\n// 2d array\ntensor array = [[2.3,4.2],[2.3,4.2]]\n\n// hashmap\nmap\u003cint, int\u003e myMap = [{2.3:62}, {63:2.3}];\nvar myMap = [{2.3:62}, {3.2:662}]\nmap\u003ctensor, int\u003e\n\n// Arbitrary-sized integers\nint\u003c16\u003e shortNum = -65536;\nint\u003c8388608\u003e maxSizedNum = 1;\nfor (int i = 0; i \u003c 2500000; i++) {\n\tmaxSizedNum *= 10; // Won't overflow!\n}\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feshaancoding%2Fvelvaprogramminglanguage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feshaancoding%2Fvelvaprogramminglanguage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feshaancoding%2Fvelvaprogramminglanguage/lists"}