Skip to content

Commit

Permalink
Initial Release
Browse files Browse the repository at this point in the history
Basic implementation.
  • Loading branch information
saikumarmk committed Dec 21, 2020
1 parent 4baba67 commit 0025c2a
Show file tree
Hide file tree
Showing 98 changed files with 4,561 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ Cargo.lock

# These are backup files generated by rustfmt
**/*.rs.bk

# vscode
/.vscode/
10 changes: 10 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[package]
name = "uwucode"
version = "0.1.0"
authors = ["Sai kumar Murali krishnan <[email protected]>"]
edition = "2018"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
colored = "2"
160 changes: 160 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@

<br />
<p align="center">
<a href="https://github.com/Theorvolt/uwucode">
<img src="images/uwucode_logo.svg" alt="Logo" width="80" height="80">
</a>

<h3 align="center">uwucode</h3>

<p align="center">
A language based around egirl slang...
<br />
<a href="https://github.com/Theorvolt/uwucode"><strong>Explore the docs »</strong></a>
<br />
<br />
<a href="https://github.com/Theorvolt/uwucode/issues">Report Bug / Request Feature</a>
</p>
</p>


# Table of Contents

1. [What is uwucode?](#what-is-uwucode?)
1. [Technical details](##technical-details)

2. [Getting started](#getting-started)
1. [Cargo requirements](##cargo-requirements)
2. [Building](##build-instructions)

3. [Writing with uwucode](#writing-with-uwucode)
1. [Syntax](##syntax)

4. [Future plans](#future-plans)

5. [Contributing](#contributing)

6. [License](#license)

7. [Contact](#contact)

8. [Extra](#extra)
1. [Why?](#why?)

9. [Acknowledgements](#acknowledgements)



# What is uwucode?

uwucode is an interpreted language written in Rust and consists of a nonsensical grammar for keywords, for instance uwu and owo are used for function and variable declarations respectively. While the language itself brings no unique features, the code used to interpret the language is good for beginners who wish to learn about language design.

## Technical details

TBA.


# Getting Started

To get a local copy up and running follow these simple steps.

## Cargo requirements

The toml file contains information on any dependencies which are automatically fetched.

## Build Instructions

1. Use Cargo to build uwucode.
```
cargo build
```
2. Done.
# Writing with uwucode
Note: uwucode output often contains characters (emojis and colored text) that may not be readable by some terminals.
Upon building uwucode, one may open a REPL by passing in the argument repl as follows:
```
uwucode repl
```
Alternatively, you can execute a file by using the open argument, supplying a file path, for instance:
```
uwucode open example.uwu
```
## Syntax
uwucode does not enforce typing and is interpreted. It is also independent of whitespace, which means indenting and spaces don't matter, but you must terminate the end of a statement. To define a variable, one would write:
```owo var = value :3```
For the sake of reference, `:3` can be replaced with `;`. For defining functions, the keyword `owo` is utilised:
```
uwu square(x) {sugoi x*x;};
```
There are more examples in the examples folder, however a list of all keywords include:
* owo - let
* uwu - define
* sugoi - return
* nuzzles - if
* dab - elif
* rawr - else
* truwu - true
* fowose - false
As of now, there are also three builtins:
* quwuit - Takes in zero arguments, terminates the program.
* len - Returns the length of a string.
* dprint - Takes in one argument, prints the object.
_For more examples, please refer to the [Documentation](https://github.com/Theorvolt/uwucode/doc)_
# Roadmap
TBD, but there's a lot I have in mind. As of now, a few things that will come are:
* while loops
* a more robust interpreter
* inputs
* basic logical operations
* compilation to bytecode
# Contributing
You forfeit any right to sue me should your sanity disappear while contributing to this code. Follow standard procedure if you wish to contribute, i.e fork->commit->pull request. You can also ask for a feature in the issues section.
# License
Distributed under the MIT License. See `LICENSE` for more information.
# Contact
Sai kumar Murali krishnan - [LinkedIn](https://www.linkedin.com/in/sai-kumar-murali-krishnan/) - [email protected]
Project Link: [https://github.com/Theorvolt/uwucode](https://github.com/Theorvolt/uwucode)
# Extra
## Why?
The inspiration for this language came about since a friend of mine had made a relatively simple gag language primarily using the letter X [over here](https://github.com/lduck11007/x/). I also wanted to learn a bit about language design and manually designing a parser was a painful but worthwhile experience. As for the actual language itself, we found it a funny idea to write docstrings in uwu speak, something I intend to add in the future. Either way, this language serves no practical use but is a great way to break into language design. I highly recommend checking out the following: [https://interpreterbook.com/](https://interpreterbook.com/).
# Acknowledgements
* Thanks to Satya for inspiration on keywords for the language and designing the logo.
*
*
15 changes: 15 additions & 0 deletions examples/factorial.uwu
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
owo hehexd = 1;

/* Comments can be written similar to Rust/C++. */
uwu fact(lel) {
nuzzles (lel==hehexd) {
sugoi lel;
}
rawr {
sugoi lel*fact(lel-hehexd);
};
};

/* One can use dprint to print function values */
dprint(fact(4));
dprint(fact(20));
13 changes: 13 additions & 0 deletions examples/fib.uwu
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@


uwu fib(x) {
nuzzles (x<=1) {
sugoi x;
}
rawr {
sugoi fib(x-1)+fib(x-2);
};
};

dprint(fib(10));
dprint(fib(20)); /* This takes a very long time to evaluate. */
5 changes: 5 additions & 0 deletions examples/prints.uwu
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@


dprint("Hello world!");

dprint(2+5);
29 changes: 29 additions & 0 deletions examples/rec_fizzbuzz.uwu
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@

/* Not operational as of now. */
uwu fizzbuzz(x) {
nuzzles (x==0) {
dprint("Done!");
}

rawr {
nuzzles (x%3==0) {
nuzzles (x%5==0) {
dprint("FizzBuzz");
sugoi fizzbuzz(x-1);
}

rawr {
dprint("Fizz");
sugoi fizzbuzz(x-1);
};
}

rawr {
nuzzles (x%5==0) {
dprint("Buzz");
sugoi fizzbuzz(x-1);
};
};
};
};
fizzbuzz(10);
1 change: 1 addition & 0 deletions images/uwucode_logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file added src/doc/.lock
Empty file.
45 changes: 45 additions & 0 deletions src/doc/COPYRIGHT.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
These documentation pages include resources by third parties. This copyright
file applies only to those resources. The following third party resources are
included, and carry their own copyright notices and license terms:

* Fira Sans (FiraSans-Regular.woff, FiraSans-Medium.woff):

Copyright (c) 2014, Mozilla Foundation https://mozilla.org/
with Reserved Font Name Fira Sans.

Copyright (c) 2014, Telefonica S.A.

Licensed under the SIL Open Font License, Version 1.1.
See FiraSans-LICENSE.txt.

* rustdoc.css, main.js, and playpen.js:

Copyright 2015 The Rust Developers.
Licensed under the Apache License, Version 2.0 (see LICENSE-APACHE.txt) or
the MIT license (LICENSE-MIT.txt) at your option.

* normalize.css:

Copyright (c) Nicolas Gallagher and Jonathan Neal.
Licensed under the MIT license (see LICENSE-MIT.txt).

* Source Code Pro (SourceCodePro-Regular.woff, SourceCodePro-Semibold.woff):

Copyright 2010, 2012 Adobe Systems Incorporated (http://www.adobe.com/),
with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark
of Adobe Systems Incorporated in the United States and/or other countries.

Licensed under the SIL Open Font License, Version 1.1.
See SourceCodePro-LICENSE.txt.

* Source Serif Pro (SourceSerifPro-Regular.ttf.woff,
SourceSerifPro-Bold.ttf.woff, SourceSerifPro-It.ttf.woff):

Copyright 2014 Adobe Systems Incorporated (http://www.adobe.com/), with
Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark of
Adobe Systems Incorporated in the United States and/or other countries.

Licensed under the SIL Open Font License, Version 1.1.
See SourceSerifPro-LICENSE.txt.

This copyright file is intended to be distributed with rustdoc output.
94 changes: 94 additions & 0 deletions src/doc/FiraSans-LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
Digitized data copyright (c) 2012-2015, The Mozilla Foundation and Telefonica S.A.
with Reserved Font Name < Fira >,

This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL


-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------

PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.

The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.

DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.

"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).

"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).

"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.

"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.

PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:

1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.

2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.

3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.

4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.

5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.

TERMINATION
This license becomes null and void if any of the above conditions are
not met.

DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
Binary file added src/doc/FiraSans-Medium.woff
Binary file not shown.
Binary file added src/doc/FiraSans-Regular.woff
Binary file not shown.
Loading

0 comments on commit 0025c2a

Please sign in to comment.