{"_id":"@arkardev/beerlang","_rev":"2-9049c8f56b20ae32915fa2333de74d81","name":"@arkardev/beerlang","dist-tags":{"latest":"0.0.5"},"versions":{"0.0.3":{"name":"@arkardev/beerlang","module":"index.ts","version":"0.0.3","description":"Beerlang is an interpreter written in Typescript","author":{"name":"ArkarDev"},"license":"MIT","type":"module","bin":{"beer":"beer/index.js"},"devDependencies":{"bun-types":"latest","typedoc":"^0.25.1","typescript":"^5.2.2"},"scripts":{"start":"bun run index.ts","build":"bun run build.ts","docs::gen":"typedoc ./index.ts ./src/* --out docs/ "},"peerDependencies":{"typescript":""},"dependencies":{"chalk":"^5.3.0"},"publishConfig":{"access":"public"},"_id":"@arkardev/beerlang@0.0.3","gitHead":"93f63639059167888312c99b1a18de7220bf2ec7","_nodeVersion":"20.8.1","_npmVersion":"10.1.0","dist":{"integrity":"sha512-54/RplZ/6N5q9TRNPFeuy/DFCkgDpkN1QIpoGvPV6Wuc/eQZwQK4hSwVJp4nAj89fN4e5XctdBNIqwqW2x9zEA==","shasum":"835994411b80f48c28951394ec4698248d6f88c0","tarball":"https://registry.npmjs.org/@arkardev/beerlang/-/beerlang-0.0.3.tgz","fileCount":101,"unpackedSize":2394514,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHvc1Gg3qb3A/ss31SpsXO4KWxye2FC4+1JAOJoH4DkCAiAFH5dogzTI3dwubbBoks2J8tUtc5iQzNozFvpbkZWfxQ=="}]},"_npmUser":{"name":"arkardev","email":"arkardev00@gmail.com"},"directories":{},"maintainers":[{"name":"arkardev","email":"arkardev00@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/beerlang_0.0.3_1697311436042_0.6291394887451589"},"_hasShrinkwrap":false},"0.0.4":{"name":"@arkardev/beerlang","module":"index.ts","version":"0.0.4","description":"Beerlang is an interpreter written in Typescript","author":{"name":"ArkarDev"},"license":"MIT","type":"module","bin":{"beer":"beer/index.js"},"devDependencies":{"bun-types":"latest","typedoc":"^0.25.1","typescript":"^5.2.2"},"scripts":{"start":"bun run index.ts","build":"bun run build.ts","docs::gen":"typedoc ./index.ts ./src/* --out docs/ "},"peerDependencies":{"typescript":""},"dependencies":{"chalk":"^5.3.0"},"publishConfig":{"access":"public"},"_id":"@arkardev/beerlang@0.0.4","gitHead":"c91a792026504762a85e2de196a631609520b19f","_nodeVersion":"20.8.1","_npmVersion":"10.1.0","dist":{"integrity":"sha512-pbs5dn2aF5+rnT+DuwFQO5iW/XZ5fJJ/sjxbEFZwEW1wZTkygLLsymHICLelZ1r1NcfkfofoyhX5skC8LaQmWg==","shasum":"0f92cdbc841d0db50dd7b4a85d06bde794539df4","tarball":"https://registry.npmjs.org/@arkardev/beerlang/-/beerlang-0.0.4.tgz","fileCount":101,"unpackedSize":2395118,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDhcxWs0iVUA8mT6hITdlBinOviBh13PzXJDZGLianpFgIhAONX7Q7Fdmu/wz1dlawI/xvUyWevrMKcZReVDJDQKCQ0"}]},"_npmUser":{"name":"arkardev","email":"arkardev00@gmail.com"},"directories":{},"maintainers":[{"name":"arkardev","email":"arkardev00@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/beerlang_0.0.4_1697311957400_0.13474075088071502"},"_hasShrinkwrap":false},"0.0.5":{"name":"@arkardev/beerlang","module":"index.ts","version":"0.0.5","description":"Beerlang is an interpreter written in Typescript","author":{"name":"ArkarDev"},"license":"MIT","type":"module","bin":{"beer":"beer/index.js"},"devDependencies":{"bun-types":"latest","typedoc":"^0.25.1","typescript":"^5.2.2"},"scripts":{"start":"bun run index.ts","build":"bun run build.ts","docs::gen":"typedoc ./index.ts ./src/* --out docs/ "},"peerDependencies":{"typescript":""},"dependencies":{"chalk":"^5.3.0"},"publishConfig":{"access":"public"},"gitHead":"27f47c6d733a893d45f1ca5e3be646ea88c8627a","_id":"@arkardev/beerlang@0.0.5","_nodeVersion":"18.0.0","_npmVersion":"8.6.0","dist":{"integrity":"sha512-ejLZihvLmWylPDQJYSuzTcdcXgqtFrxvrgeoR5rGGSHuRV+032Dyhf6c5A/raAvjxF/SOkI2wxWK3yhT5HgDow==","shasum":"614214981353633efd9ceb8cbeab7972365414df","tarball":"https://registry.npmjs.org/@arkardev/beerlang/-/beerlang-0.0.5.tgz","fileCount":101,"unpackedSize":2362636,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDZ9JTadc+ZqKH6/r4o0wNrIso3UwGEDmSgOIz2iTHkJAiEA+4wSz/5Bkd/4UAGE3iWteOlzG8SdvwI/5yZAuW6Vm00="}]},"_npmUser":{"name":"arkardev","email":"arkardev00@gmail.com"},"directories":{},"maintainers":[{"name":"arkardev","email":"arkardev00@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/beerlang_0.0.5_1698938197796_0.5984558461821492"},"_hasShrinkwrap":false}},"time":{"created":"2023-10-14T19:23:55.903Z","0.0.3":"2023-10-14T19:23:56.345Z","modified":"2023-11-02T15:16:38.154Z","0.0.4":"2023-10-14T19:32:37.716Z","0.0.5":"2023-11-02T15:16:37.991Z"},"maintainers":[{"name":"arkardev","email":"arkardev00@gmail.com"}],"description":"Beerlang is an interpreter written in Typescript","author":{"name":"ArkarDev"},"license":"MIT","readme":"# Beer\n\nBeer is an interpreter for the Beerlang programming language, written in TypeScript.\n\n## Introduction\n\nBeerlang is a dynamically-typed, interpreted programming language designed for simplicity and fun.\n\n## Installation\n\nBeerlang is developed using bun.js. Make sure you have installed bun.js on your local machine.\n\nTo install Beerlang globally via npm, you can use the following command:\n\n```\nnpm i -g @arkardev/beerlang\n```\n\nThis will install Beerlang as a global package, allowing you to run it from any directory in your system.\n\nAfter installing Beerlang globally, you can execute Beerlang scripts using the `beer` command followed by the path to your Beerlang script file, like this:\n\n```\nbeer myscript.beer\n\n```\n\nReplace `myscript.beer` with the path to your Beerlang script file.\n\nBy installing Beerlang globally, you can access it as a command-line tool and run Beerlang scripts conveniently.\n\n### Planned Features\n\n- **Emoji Support**: Beerlang is designed to support emojis as part of its syntax, adding a touch of fun and expressiveness to the language. You will be able to use emojis as variable names, function names, and even as operators.\n- **Funny Syntax**: Beerlang embraces a playful and unconventional syntax that encourages creativity and experimentation. It includes elements such as using \"🍺\" instead of parentheses for function calls and \"🍻\" instead of curly braces for code blocks.\n\nStay tuned for these exciting additions to Beerlang!\n\n## Features\n\n- **Easy to Learn**: Beerlang has a simple syntax and minimalistic design, making it easy for beginners to grasp.\n- **Dynamic Typing**: Variables in Beerlang are dynamically typed, allowing for flexible programming.\n- **Extensible**: Beerlang supports the creation of user-defined functions and encourages code modularity.\n\n## Syntax\n\n### Data types\n\nBeerlang supports the following data types:\n\n- **Number**: Numbers in Beerlang are represented by numeric literals. For example, `var a = 12;` and `var b = 26;` assign the values 12 and 26 to variables `a` and `b`, respectively.\n- **String**: Strings are sequences of characters enclosed in double quotes (`\"`). For example, `var breakfast = \"break\";` assigns the string \"break\" to the variable `breakfast`. You can concatenate strings using the `+` operator, as shown in the example `print \"Today's breakfast is \" + breakfast + \".\";`.\n- **Boolean**: Beerlang has two boolean values: `true` and `false`. For example, `var t = true;` assigns the value `true` to the variable `t`, while `var f = false;` assigns `false` to the variable `f`.\n- **Nil**: In Beerlang, `nil` represents the absence of a value. For example, `var notExists = nil;` assigns `nil` to the variable `notExists`. When you print `notExists`, it will display `nil`.\n\n```tsx\nvar a = 12;\nvar b = 26;\nprint a + b;\n\nvar t = true;\nvar f = false;\nvar notExists = nil;\n\nprint notExists;\n\nvar breakfast = \"break\";\nprint \"Today's breakfast is \" + breakfast + \".\";\n```\n\n### Operators\n\nBeerlang supports the following arithmetic operators:\n\n- **Addition (+)**: The addition operator is used to add two numbers together. For example, `var sum = 2 + 3;` assigns the value 5 to the variable `sum`.\n- **Subtraction (-)**: The subtraction operator is used to subtract one number from another. For example, `var difference = 7 - 4;` assigns the value 3 to the variable `difference`.\n- **Multiplication (\\*)**: The multiplication operator is used to multiply two numbers. For example, `var product = 5 * 6;` assigns the value 30 to the variable `product`.\n- **Division (/)**: The division operator is used to divide one number by another. For example, `var quotient = 10 / 2;` assigns the value 5 to the variable `quotient`.\n\nHere's an example that demonstrates the usage of these operators:\n\n```tsx\nvar a = 2 + 3; // Addition\nvar b = 7 - 4; // Subtraction\nvar c = 5 * 6; // Multiplication\nvar d = 10 / 2; // Division\n\nprint a; // Output: 5\nprint b; // Output: 3\nprint c; // Output: 30\nprint d; // Output: 5\n\n```\n\nThese operators can be used with variables, numeric literals, and expressions to perform arithmetic operations in Beerlang.\n\n### Control flows\n\nBeerlang supports the following control flow statements:\n\n### `if` statement\n\nThe `if` statement allows you to conditionally execute a block of code based on a Boolean expression.\n\nHere's an example that demonstrates the usage of the `if` statement:\n\n```tsx\nvar a = -10;\nvar condition = a > 3;\nif (condition) {\n  print \" I am true...\";\n} else {\n  print \" I am false...\";\n}\n```\n\n### `while` loop\n\nThe `while` loop allows you to repeatedly execute a block of code as long as a condition is true.\n\nHere's an example that demonstrates the usage of the `while` loop:\n\n```tsx\nvar i = 1;\nwhile (i < 8) {\n  print i;\n  i = i + 1;\n}\n```\n\n### `for` loop\n\nThe `for` loop allows you to iterate over a range of values or elements in Beerlang.\n\n```tsx\nfor (var i =0; i < 10; i= i + 1){\n    print i;\n}\n```\n\nThese control flow statements allow you to make decisions, repeat actions, and iterate over values in Beerlang, adding flexibility and control to your programs.\n\n### Functions\n\nIn Beerlang, functions are first-class citizens, which means they can be assigned to variables, passed as arguments to other functions, and returned as values from other functions. You can define functions using the `fun` keyword, followed by the function name and a pair of parentheses for the parameter list. The function body is enclosed in curly braces `{}`.\n\nHere's an example of a function that adds two numbers:\n\n```tsx\nfun add(a, b) {\n  return a + b;\n}\n\nvar result = add(3, 4);\nprint(result); // Output: 7\n\nfun fib(n) {\n  if (n <= 1) return n;\n  return fib(n - 2) + fib(n - 1);\n}\nfor (var i = 0; i < 20; i = i + 1) {\n  print fib(i);\n}\n\n```\n\n### Closures\n\nBeerlang supports closures, which are functions that have access to variables from their outer (enclosing) scope. This allows functions to \"remember\" the values of variables even after they have finished executing. Closures can be useful for creating functions with private variables or for implementing callback functions.\n\nHere's an example of a closure in Beerlang:\n\n```tsx\nfun counter() {\n  var count = 0;\n\n  fun increment() {\n    count = count + 1;\n    print(\"Count: \" + count);\n  }\n\n  return increment;\n}\n\nvar counterFunc = counter();\ncounterFunc(); // Output: Count: 1\ncounterFunc(); // Output: Count: 2\n\n```\n\nIn the example above, the `counter` function returns the `increment` function, which has access to the `count` variable in its outer scope. Each time the `increment` function is called, it increments the `count` variable and prints the updated value.\n\nClosures in Beerlang provide a powerful mechanism for creating functions with encapsulated state and behavior.\n\n### Classes\n\nBeerlang supports object-oriented programming through the use of classes. A class is a blueprint for creating objects that share similar properties and behaviors. In Beerlang, you can define classes using the `class` keyword, followed by the class name and a pair of curly braces `{}` to enclose the class body.\n\nIn Beerlang, the `init` method is used as a constructor for a class. It is called when a new instance of the class is created. The `init` method initializes the properties of the class and performs any necessary setup.\n\nHere's an example of a class definition in Beerlang:\n\n```tsx\nclass Breakfast {\n  init() {\n    this.name = \"cake\";\n    this.number = 2;\n    print \"Cakes ready!\";\n  }\n\n  eat() {\n    if (this.number > 0) {\n      print \"Eating \" + this.name + \"...\";\n      this.number = this.number - 1;\n    } else {\n      print \"Nothing to eat.\";\n    }\n  }\n}\nvar breakfast = Breakfast();\nvar quickEat = breakfast.eat;\nquickEat();\nbreakfast.eat();\nquickEat();\n\n```\n\nBeerlang's class-based approach allows you to organize your code into reusable and modular components, making it easier to manage and maintain your programs.\n\n### Inheritance\n\nIn Beerlang, you can create classes that inherit properties and behaviors from other classes. This is known as inheritance and allows you to create a hierarchy of classes with shared characteristics.\n\nTo define a class that inherits from another class, you can use the `<` keyword followed by the name of the parent class. The child class can then access and override the properties and methods of the parent class.\n\nHere's an example that demonstrates inheritance in Beerlang:\n\n```tsx\nclass Doughnut {\n  cook() {\n    print \"Fry until golden brown.\";\n  }\n}\n\nclass BostonCream < Doughnut {\n  cook() {\n    super.cook();\n    print \"Pipe full of custard and coat with chocolate.\";\n  }\n}\n\nBostonCream().cook();\n```\n\nInheritance allows you to reuse code and create a more organized and modular class structure in Beerlang.\n\n## Installation\n\nTo use Beerlang, ensure that you have Bun.js and npm installed on your system. Then, follow these steps:\n\n1. Clone the Beerlang repository: `git clone https://github.com/Riley1101/Beerlang`>\n2. Navigate to the repository: `cd beerlang`\n3. Install dependencies: `bun install`\n4. Build the project: `bun run build`\n5. Run Beerlang: `bun start`\n\n### Running Beerlang Script\n\nTo execute a Beerlang script, use the following command:\n\n```\nbun beer myscript.beer\n```\n\nReplace `myscript.beer` with the path to your Beerlang script file.\n\n## Examples\n\nCheckout examples in `/examples`\n\n## Contributing\n\nContributions to Beerlang are welcome! If you find any bugs, have feature requests, or want to contribute enhancements, please open an issue or submit a pull request on the\n\n## Roadmap\n\nThe next step in the development of Beerlang is to add more fun to it. This will involve introducing some funny syntax to make the language even more playful and unconventional. Stay tuned for these exciting additions to Beerlang!\n\n## Resources\n\n- https://www.edx.org/learn/computer-science/stanford-university-compilers\n- https://craftinginterpreters.com/\n- https://www.amazon.com/Compilers-Principles-Techniques-Tools-2nd/dp/0321486811\n\n## License\n\nBeerlang is open source and released under the [MIT License](https://www.notion.so/arkardev/LICENSE).\n","readmeFilename":"README.md"}