{"id":23255884,"url":"https://github.com/rasheedmhd/llama","last_synced_at":"2025-04-06T03:45:11.773Z","repository":{"id":236591069,"uuid":"792919579","full_name":"rasheedmhd/llama","owner":"rasheedmhd","description":"A programming language impl from Robert Nystrom's Crafting Interpreters","archived":false,"fork":false,"pushed_at":"2024-05-28T23:35:07.000Z","size":48,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-05-29T01:03:33.079Z","etag":null,"topics":["ast","byte","lexer","parser","programming","programming-language","scanner"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/rasheedmhd.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":"2024-04-27T23:26:38.000Z","updated_at":"2024-05-30T06:27:03.452Z","dependencies_parsed_at":"2024-05-19T00:26:35.361Z","dependency_job_id":"2f357ce3-1946-43ba-985e-e2398d48de77","html_url":"https://github.com/rasheedmhd/llama","commit_stats":null,"previous_names":["rasheedmhd/llama"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rasheedmhd%2Fllama","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rasheedmhd%2Fllama/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rasheedmhd%2Fllama/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rasheedmhd%2Fllama/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rasheedmhd","download_url":"https://codeload.github.com/rasheedmhd/llama/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247430836,"owners_count":20937873,"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":["ast","byte","lexer","parser","programming","programming-language","scanner"],"created_at":"2024-12-19T11:32:50.855Z","updated_at":"2025-04-06T03:45:11.740Z","avatar_url":"https://github.com/rasheedmhd.png","language":"Rust","readme":"# Syntax\n\n# Comments\n\n```\n// This is a comment\n```\n\n# Printing to Std Output\n\n```\n\u003e print \"Hello, world!\";\nHello, world!\n```\n\n# DATA TYPES\n\n# Booleans\n\n```\n\u003e true; // Not false.\ntrue\n\u003e false; // Not False\nfalse\n```\n\n# Numbers\n\n```\n1234; // An integer.\n12.34; // A decimal number\n```\n\n# Strings\n\n```\n\"I am a string\";\n\"\"; // The empty string.\n\"123\"; // This is a string, not a number.\n```\n\n# No Value\n\n```\nnil\n```\n\n# Expressions\n\n## Arithmetic\n\n```\nadd + me;\nsubtract - me;\nmultiply * me;\ndivide / me;\n\n-negateMe;\n```\n\n# Comparison and Equality\n\n## Comparison Operators.\n\n```\nless \u003c than;\nlessThan \u003c= orEqual;\ngreater \u003e than;\ngreaterThan \u003e= orEqual;\n\n1 == 2; // false.\n\"cat\" != \"dog\"; // true\n\n314 == \"pi\"; // false\n\n123 == \"123\"; // false\n```\n\n## Logical operators\n\n```\n!true; // false.\n!false; // true.\n\ntrue and false; // false.\ntrue and true; // true.\n\nfalse or false; // false.\ntrue or false; // true.\n```\n\n# Precedence and Grouping\n\n```\nvar average = (min + max) / 2;\n```\n\n# Statements\n\n```\nprint \"Hello, world!\";\n\n{\n    print \"One statement.\";\n    print \"Two statements.\";\n}\n\n```\n\n# Variables\nLlama is dynamically typed, so you can assign a value of any type to variables declared prior.\n```\n\nvar breakfast \t= \"bagels\";\nprint breakfast; // \"bagels\".\n\nbreakfast \t= \"beignets\";\nprint breakfast; // \"beignets\".\n\n```\n\n# Shadowing\n```\n\nvar breakfast = \"bagels\";\n\u003e print breakfast;\nbagels;\nvar breakfast = \"croissant\";\n\u003e print breakfast;\ncroissant\n\n```\n\n\n# Control Flow\n\n## if\n\n```\nif (condition) {\n    print \"yes\";\n} else {\n    print \"no\";\n}\n```\n\n## while\n\n```\nvar a = 1;\n\nwhile (a \u003c 10) {\n    print a;\n    a = a + 1;\n}\n```\n\n## for\n\n```\nfor (var a = 1; a \u003c 10; a = a + 1) {\n    print a;\n}\n```\n\n# Functions\n\n```\n// Functions that take arguments\nmakeBreakfast(bacon, eggs, toast);\n\n// Functions that do not toake arguments\nmakeBreakfast();\n```\n\n# fun keyword\n\n```\nfun printSum(a, b) {\n    print a + b;\n}\n\nfun returnSum(a, b) {\n    return a + b;\n}\n```\n\n# Closures\n\n```\n\nfun addPair(a, b) {\n    return a + b;\n}\nfun identity(a) {\n    return a;\n}\n\nprint identity(addPair)(1, 2); // Prints \"3\"\n\nfun outerFunction() {\n    fun localFunction() {\n        print \"I'm local!\";\n    }\n    localFunction();\n}\n\nfun returnFunction() {\nvar outside = \"outside\";\n    \n    fun inner() {\n        print outside;\n    }\n    \n    return inner;\n}\n\nvar fn = returnFunction();\nfn();\n\n```\n\n# Classes\n\n```\n// The body of a class contains its methods.\n// They look like function declarations but without the fun keyword.\nclass Breakfast {\n    \n    cook() {\n        print \"Eggs frying!\";\n    }\n    \n    serve(who) {\n        print \"Enjoy your breakfast, \" + who + \".\";\n    }\n    \n}\n```\n\n## Classes are First Class\n\n```\n\n// Storing Classes in Variables.\nvar someVariable = Breakfast;\n\n// Passing Classes to Functions.\nsomeFunction(Breakfast);\n\n```\n\n## Class Instances\n\n```\n// Calling a class like a function, produces a new instance of itself.\nvar breakfast = Breakfast();\nprint breakfast; // \"Breakfast instance\".\n```\n\n## Instantiation and Initialization\n\n```\n\n// Assigning to a field creates it if it doesn’t already exist\nbreakfast.meat = \"sausage\";\nbreakfast.bread = \"sourdough\";\n\n// If you want to access a field or method on the current object\n// from within a method, you use good old this.\n\nclass Breakfast {\n    serve(who) {\n        print \"Enjoy your \" + this.meat + \" and \" +\n        this.bread + \", \" + who + \".\";\n    }\n    // ...\n}\n\nclass Breakfast {\n    init(meat, bread) {\n        this.meat = meat;\n        this.bread = bread;\n    }\n    // ...\n}\n\nvar baconAndToast = Breakfast(\"bacon\", \"toast\");\n\nbaconAndToast.serve(\"Dear Reader\");\n// \"Enjoy your bacon and toast, Dear Reader.\"\n\n```\n\n# Inheritance\n\n```\n\nclass Brunch \u003c Breakfast {\n    drink() {\n        print \"How about a Bloody Mary?\";\n    }\n}\n\n// Every method defined in the superclass is also available to its subclasses.\nvar benedict = Brunch(\"ham\", \"English muffin\");\nbenedict.serve(\"Noble Reader\");\n\n// Even the init() method gets inherited.\n// In practice, the subclass usually wants to define its own init() method too.\nclass Brunch \u003c Breakfast {\n    init(meat, bread, drink) {\n        super.init(meat, bread);\n        this.drink = drink;\n    }\n}\n\n```","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frasheedmhd%2Fllama","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frasheedmhd%2Fllama","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frasheedmhd%2Fllama/lists"}