Skip to content

Latest commit

 

History

History
533 lines (435 loc) · 27.2 KB

README.md

File metadata and controls

533 lines (435 loc) · 27.2 KB

Welcome to the world of Kpop Comp-Sci!

This md file will serve as your intro the language that I have created. It's called ARMY++ and it was a labour of love, sweat and tears (a lot of tears, btw). Thank you for even showing the interest in reading the documentation!

This documentation was written by me (yes, a bit too vain if you ask me) and I would love to take any and all suggestions from the community because the community is just too damn awesome! Now, if you don't mind I will list out all the other links so, you can go check out all the stories and documentation that you need for this language.

  1. The story of the language : The Story
  2. The reason for choosing the keywords that I did : The choice of keywords
  3. The real real docs : The official documentation of The ARMY Project
  4. How to run the language? : Installation Guide and setting up

The ARMY++ Language

Now, this section details why I wanted to create the language and the entire (not so) sob story of what went down. If you think I could've done something better, lemme know 'cause future me will save a lot of mental breakdowns and tears while doing another project.

The beginnings

Now, I created this language for 2 reasons.

  1. I wanted to submit it to the "Hack your Portfolio" competition for MLH's weekend hackathon. It had been far too long since I had participated in one of those
  2. I wanted to really experience what it is like to build a language. It turned out to be a real labour of love, btw.

But, why go through all of that?

Hehe, I like to torture myself. That's why. No ! that's not the real reason. I actually made this because, I see myself as somewhat of a fan of esoteric languages. Hey, languages like MOO lang, Bhai lang, mindfuck are just fun to look at and laugh. I wanted to contribute to one of those languages and also maybe pay homage to my favourite music industry. (And no, k-pop is not a genre, I will not hear any arguments about it! No, sir!)

What was the experience like, you ask?

Well well well, how the turntables .......! I guess you get it now. It was, hehe, not pretty. I struggled to understand how to implement a language. I reeeaallly, couldn't get the code to work and I fell victim to my own creation. So yeah, it was a big process of trial and error because this was the first time I was taking up a project that was this complicated and also because, I decided not to watch any YouTube videos or read up on any projects that were implemented by other people and just straight up do it based on my knowledge of computers and how they work.

But, what is the conclusion to this?

Well, the conclusion that at least I have derived is this : Don't be a fool and start something without doing any background research. PLEASE know what you are getting into and then, see if you can actually do it. Otherwise, you're gonna have a mental break-down or two in the span of 24 hours and your parents and friends will be worried sick.

Ain't no need for that. A single YouTube video or a StackOverflow search is gonna save you all that pain.

Thank me later

The story of the keywords

Well now that you are officially here, lemme introduce you to some k-pop terms so that you can better understand the language and maybe my choices will become a bit intuitive. (Also sorry not sorry for this gif of J-Why-Pee)

Quick disclaimers :

  1. This language isn't so modular, right now. What that means is, anything you write should be written in the main function. Please don't judge me for it
  2. The language resembles C a lot, because I thought it was ancient and easy to model after. Any design choices for the language are made keeping that in mind.
  3. Just have fun experimenting with the language.

Onto the terms!

  1. Annyeong : It is the Korean word for "hello". (please use it informally, you can't tell you teachers that) Kinda was a no brainer that that would be my keyword for a function definition

  2. Saranghae : It is the word for "I love you". You need to say it out loud sometimes, you know! Hence, that became my choice for the print statement.

  3. Idol : Idols are the people in K-pop groups. They are the ones whose faces you see all the time. Whether as the faces of some of the biggest tech companies or as the global ambassadors to luxury fashion houses, they are everywhere. So, I made that the word for variable declaration.

  4. Shinee : They are one of the most famous groups to come out of the 2nd generation of K-pop (when K-Pop was just starting to get popular in Asia). They used to be a 5-member group but are now a 4-member group. So, they are now the keyword to declare numbers.

  5. GG aka Girls' Generation : Girls' Generation was also referred to as the nation's girl group in Korea at the peak of their popularity due to a string of hit songs and hit albums. The now 8-member group is seen as a legend and one of their songs "Into the new world" is seen as an anthem for hoping for a brighter and better future and is often sung at Pride events. That is why, I made gg the keyword for strings!

  6. EXO : EXO was a gigantic 12-member group that debuted in 2012. (Somewhere at the beginning of the 3rd generation of K-pop when the industry was taking the world by storm) The group rose to fame with their uniques concept of superpowers and is seen as one of the most famous Idol groups in S. Korea. They are now the keyword for bools!

  7. BTS : Is there anyone on the planet who doesn't know BTS at this point? They have drenched the world in hues of purple with their songs and albums that spread the message of self-love and acceptance. (If you don't know, I personally got into K-Pop because of them) They have only continued to add to their already long list of achievements even when the members are serving in the military (S. Korea is a country where conscription into the military is mandatory for able-bodied men, so the members are serving in the military). Hence, they are now the keyword for addition

  8. Black Pink : Blackpink is the 2nd girl group from the legendary label YG and they quickly became one of the most popular girl groups from the industry due to their girl-crush concept and the immense charm that the members posses. The group is also notorious for having lazy management that has never given the members correct representation and a few albums to their name. Hence, the position of Subtraction.

  9. Twice : Twice is also another super-popular girl group whose 9 members are from S. Korea, Japan and Taiwan. The group is the product of a TV show call Mix-9 which had the viewers follow the trainees on their journey as they slowly became what is now, a highly successful girl group that is loved by the general public of Korea and the world! Due to their highly multi-cultural backgrounds, they are now the keyword for multiplication.

  10. Red Velvet : Red velvet is another girl-group that followed the super popular Girls' Generation from the same label, SM Entertainment. RV started off as a 4-member group and became a fully formed 5-member one a year after their debut. They have 2 concepts : a Red concept which follows the traditional girly, bubble pop sound and a darker Velvet concept that has a more house and overall darker sound. So, they are the keyword for division.

  11. Ikon : IKON is another group from YG that was really popular when they debuted because they were also formed from another TV show that followed the trainees on their journey to debuting under the group. The members of the group were all participants in another TV but, they lost there only to come back even more popular. Hence they are reserved for equality!

  12. Fighting : This word is just a generic word to say "All the best!" or "Break a leg!". Since the word itself starts with the letters "fi", it is now the word for the if statement

  13. Daebak : This word stands for "Amazing" or "Mind-blowing" or "OMG, that's sooo awesome!". So, it became the keyword for the else statement.

  14. Dance : Of course, no K-pop music video is complete without some bone-breaking, fracture-inducing moves on part of the idols. I wanted to incorporate this really integral part of the fandom and I made it the keyword for a while loop

  15. Comeback : Now, a comeback in K-pop is extremely different from how the word is used to describe artists from the West. Let's say you're a Swiftie. Taylor Swift drops an album after she has worked on it for years together. So, she has a comeback in like 2 years or so. But, K-pop groups drop an album (a mini one or a studio one) roughly every 6 months. So, yeah! Each group has a comeback at least twice a year. So, keeping in mind this recurring nature of comebacks, I made it the keyword for a for loop.

  16. Kpop : Ah, the word itself! Again, I still maintain my view that it is not a genre rather, it is an entire industry that contributes a shit ton to the entire GDP of S. Korea! So yeah, it is the keyword that you are gonna use to end every statement much like a semi-colon (;).

  17. BigBang : The most violently iconic group that changed the face of K-Pop forever. If I start talking about BigBang, you will probably never reach the end of this document. Just know that BigBang is the favourite of all your favourite K-Pop idols. No doubt, they deserve the keyword for greater than!

  18. JYP : Now, is he a meme? Yes. Is he the man behind the most popular groups out there? Yes. Is he just the most extra CEO of a K-pop label. Yes. Just go down the YT rabbit hole to see why he is the bestest meme material out there. So, he takes the cake for the keyword for lesser than!

  19. Super Junior : Why SuJu? 'Cause they deserve every award out there for spreading K-Pop around the world. This group is responsible for some of the best ear-worms and also the hosts of all your fav K-Variety shows. Just listen to their discography and then talk to me.

  20. Stray Kids : They became the first act from S. Korea to walk the MET carpet. They have an amazing discography and 2 of their members are Australian! Can they get any cuter? NAURRRR

  21. Record : Well, you record records, don't ya? So, to keep in mind the amazing wordplay, I have used this as the keyword to read any inputs from the user!

  22. Playback : It is the word for the technology that is used to listen to what artists have just recorded. So, I used the word to represent the writing operation, i.e., the language just tells you what you told it. Simple!

The official Documentation of the ARMY++ Language

Yes, that is the name of the project itself. The language is called ARMY++ Let us become more serious and get started with the docs!

ARMY++ : A language for K-pop lovers by a K-pop lover

Table of Contents :

  1. Overview
  2. Language Syntax
    1. Program Structure
    2. Data Types
    3. Variables
    4. Arithmetic Operators
    5. Logical Operators
    6. Expressions
    7. Control Structures
    8. Conditional Statements
    9. Loops
    10. Print Statements
  3. Read and Write Statements
  4. Error Handling Capabilities
  5. Example Programs
  6. Future Enhancements

Overview

ARMY++ is a custom language designed with K-pop terminology and themes. This language allows you to write programs using K-pop inspired syntax and semantics.

Language Syntax

Program Structure :

Any program starts with the keyword annyeong followed by the program name and the block of statements that are to be executed. All statements end with the keyword kpop.

annyeong main() {
//statements to be executed
...
...
}

Data Types :

Army++ right now supports 3 different data types :

  • Number : Numbers can be defined using the keyword shinee
  • Strings : Strings are defined using the keyword gg
  • Booleans : Bools are defined with the keyword exo

Variables :

Variables are assigned by using the keyword idol . Use the keyword before the name of the variable and is followed by an = sign. Some examples are given below

idol x = shinee 5 kpop
idol y = gg "Hello, K-pop!"
idol z = exo false kpop

Arithmetic Operators :

All the basic arithmetic operators are available in ARMY++. They are as follows:

  1. Addition : bts
  2. Subtraction : bp
  3. Multiplication : twice
  4. Division : rv

Logical Operators :

The basic implementation of all the logical operators are also available as various keywords. They are detailed as follows :

  1. Greater Than : bb
  2. Lesser Than : jyp
  3. Greater Than or Equal to : sj
  4. Lesser Than or Equal to : skz

Expressions :

Expressions can involve arithmetic operators, logical operators, numbers, strings and booleans.

idol x = shinee 5 kpop
idol y = y bts shinee 10 kpop
idol z = gg "Hello, K-pop!"

Control Structures :

Conditional Statements :

Conditional statements are created using the words fighting and daebak. Both the keywords stand for the if and else blocks in all standard languages.

fighting(x ikon shinee 10) {
// if statements
} daebak {
// else statements
}

Loops :

ARMY++ supports 2 kinds of loops a dance (while) loop and a comeback (for) loop. They can be implemented as follows :

dance (x bp shinee 0) {
    // block
}

comeback (idol i = shinee 0 kpop i bp shinee 5 kpop i bts shinee 1) {
    // block
}

Print Statements :

Statements can be printed by using the saranghae keyword.

saranghae(x) kpop
saranghae("Hello, World!") kpop

Error Handling Capabilities :

ARMY++ provides robust error handling capabilities to help developers identify and resolve issues in their code. The language implements error detection and reporting at various stages of code execution, including lexical analysis, parsing, and runtime.

Types of Errors

  1. Lexical Errors : These errors occur during the tokenisation process when the lexer encounters invalid characters or tokens. Example :
annyeong main() {
	idol @invalid_name = shinee 10 kpop
}

Error message : LexerError: Illegal character '@' at line 2, position 8 2. Syntax Errors : These errors happen when the parser encounters code that doesn't conform to ARMY++'s grammar rules.

annyeong main() { fighting(x > 5 { // Missing closing parenthesis saranghae(x) kpop } }

Error message : SyntaxError: Unexpected token '{' of type LBRACE at line 2, position 18 3. Runtime Errors : These errors occur during program execution and include issues like undefined variables, division by zero, or type mismatches. Example :

annyeong main() { 
idol x = shinee 10 kpop 
idol y = shinee 0 kpop 
idol z = x rv y kpop // Division by zero 
saranghae(z) kpop 
}

Error message : Error: Division by zero

Error Handling Mechanisms

  1. Lexer Error Handling The lexer identifies and reports illegal characters, providing the line number and position of the error.

  2. Parser Error Handling The parser detects syntax errors and provides detailed information about unexpected tokens, including their type and position in the code.

  3. Interpreter Error Handling The interpreter uses a custom KpopInterpreterError exception to handle runtime errors. It provides informative error messages for various scenarios, such as:

  • Undefined variables
  • Division by zero
  • Invalid operations
  • Unknown statement or expression types

Best Practices for Error Handling in ARMY++

  1. Always check the error messages provided by the interpreter. They contain valuable information about the nature and location of the error.

  2. Use meaningful variable names to make it easier to identify the source of errors.

  3. Test your code incrementally, adding small portions at a time to isolate errors more effectively.

  4. When encountering runtime errors, check for common issues like uninitialized variables or incorrect mathematical operations.

  5. If you encounter an "Unexpected error" message, it may indicate a bug in the interpreter itself. In such cases, please report the issue to the ARMY++ development team.

Reading and writing user inputs

ARMY++ supports basic input and output operations:

  • Input: Use the record keyword to get user input.
  • Output: Use the playback keyword to display output without a newline.

Example:

idol name = gg "" kpop
saranghae("What's your name? ") kpop
record(name) kpop
playback("Hello, ") kpop
playback(name) kpop
playback("! Welcome to K-pop Programming!\n") kpop

Future Enhancements

The ARMY++ team is continuously working on improving error handling capabilities. Future versions may include:

  • More detailed error messages with suggestions for fixing common issues
  • A debug mode with step-by-step execution and variable inspection
  • Integration with popular IDEs for enhanced error highlighting and code suggestions

By leveraging these error handling capabilities, ARMY++ developers can write more robust and reliable code, making the K-pop inspired programming experience even more enjoyable!

Example Programs :

  1. Basic variable assignment and printing :
annyeong main() {
  idol group = gg "BTS" kpop
  idol members = shinee 7 kpop
  saranghae(group) kpop
  saranghae(members) kpop
}

The output is :

BTS
7
  1. Conditional Statements :
annyeong main() {
  idol views = shinee 100000000 kpop
  fighting(views bb shinee 50000000) {
    saranghae(gg "Wow, it's a hit!") kpop
  } daebak {
    saranghae(gg "Keep streaming!") kpop
  }
  
  idol rank = shinee 2 kpop
  fighting(rank ikon shinee 1) {
    saranghae(gg "We're number one!") kpop
  } daebak {
    saranghae(gg "Let's work harder!") kpop
  }
}

The output should be :

Wow, it's a hit!
Let's work harder!
  1. Arithmetic Operators :
annyeong main() {
  idol albums = shinee 5 kpop
  idol songs = shinee 12 kpop
  idol total_tracks = albums twice songs kpop
  saranghae(total_tracks) kpop
  
  idol fans = shinee 1000000 kpop
  idol new_fans = shinee 50000 kpop
  idol total_fans = fans bts new_fans kpop
  saranghae(total_fans) kpop
}

The output is :

60
1050000
  1. While Loop :
annyeong main() {
  idol stream_count = shinee 0 kpop
  dance(stream_count jyp shinee 5) {
    saranghae(gg "Streaming...") kpop
    idol stream_count = stream_count bts shinee 1 kpop
  }
  saranghae(gg "Finished streaming!") kpop
}

The output is :

Streaming...
Streaming...
Streaming...
Streaming...
Streaming...
Finished streaming!
  1. For Loop :
annyeong main() {
  comeback(idol i = shinee 1 kpop i skz shinee 6 kpop i bts shinee 1) {
    saranghae(gg "Learning Kpop dance move ") kpop
    saranghae(i) kpop
  }
}

The output is :

Learning Kpop dance move 
1
Learning Kpop dance move 
2
Learning Kpop dance move 
3
Learning Kpop dance move 
4
Learning Kpop dance move 
5
  1. Combining multiple features :
annyeong main() {
  idol groups = shinee 5 kpop
  idol members_per_group = shinee 4 kpop
  idol total_members = shinee 0 kpop

  comeback(idol i = shinee 1 kpop i skz groups bts shinee 1 kpop i bts shinee 1) {
    idol total_members = total_members bts members_per_group kpop
    saranghae(gg "Group ") kpop
    saranghae(i) kpop
    saranghae(gg " has ") kpop
    saranghae(members_per_group) kpop
    saranghae(gg " members") kpop
  }

  saranghae(gg "Total members in all groups: ") kpop
  saranghae(total_members) kpop

  fighting(total_members bb shinee 20) {
    saranghae(gg "That's a lot of idols!") kpop
  } daebak {
    saranghae(gg "We need more groups!") kpop
  }
}

The output is :

Group 
1
 has 
4
 members
Group 
2
 has 
4
 members
Group 
3
 has 
4
 members
Group 
4
 has 
4
 members
Group 
5
 has 
4
 members
Total members in all groups: 
20
That's a lot of idols!
  1. Reading and Writing User Input :
annyeong main() {
    idol favorite_group = gg "" kpop
    saranghae("What's your favorite K-pop group? ") kpop
    record(favorite_group) kpop
    playback("Wow! ") kpop
    playback(favorite_group) kpop
    playback(" is a great choice!\n") kpop
}

The outout will be :

What's your favourite K-pop group? BTS
Wow!
BTS is a great choice!

Future Enhancements

While ARMY++ already offers a unique and engaging programming experience, we have exciting plans to further develop and expand the language. Here are some potential enhancements we're considering for future versions:

  1. Advanced Data Structures

    • Implement 'fandom' as arrays or lists to handle collections of data
    • Add 'album' as a dictionary or hash map type for key-value pairs
  2. Functions and Modularity

    • Introduce 'concert' as a keyword for function definitions
    • Implement 'featuring' for function calls and parameter passing
  3. Object-Oriented Programming

    • Develop 'idol_group' as a class construct
    • Use 'trainee' for object instantiation
  4. Standard Library

    • Create a 'lightstick' module with common utility functions
    • Implement a 'fanchant' module for string manipulation
  5. Error Handling and Debugging

    • Introduce 'soundcheck' as a try-catch mechanism for exception handling
    • Develop a 'rehearsal' mode for step-by-step debugging
  6. Concurrency

    • Implement 'dance_practice' for multi-threading capabilities
  7. Package Management

    • Create an 'agency' system for managing external libraries and dependencies
  8. Interactive Development Environment (IDE)

    • Develop a 'studio' IDE specifically designed for ARMY++ with syntax highlighting and auto-completion
  9. Performance Optimization

    • Implement a 'comeback_stage' phase for code optimization before execution
  10. Web Development

    • Create 'fansite' libraries for building web applications in ARMY++
  11. Mobile App Development

    • Develop 'fancam' tools for creating mobile applications using ARMY++

These enhancements aim to make ARMY++ more powerful, versatile, and enjoyable for developers while maintaining its unique K-pop theme. I'm excited about the future of ARMY++ and welcome community feedback on these proposed features!

Installation Guide and Setting Up

  1. Install all the files in this repo onto your device.
  2. Open them up into your favourite code editor.
  3. Run all the files to make sure you have no errors (This is a safety precaution. Feel free to skip this step)
  4. Run the main file which is aptly named "main.py"
  5. From there, you can write your program in the terminal and start using the ARMY++ language.
  6. If you want to see any changes made to the language itself, or to the documentation, feel free to fork this repo and make the changes that you would like to see implemented.

PS : Don't hesitate to reach out to me on Instagram, my handle is uma_dhatri! Hope to see some amazing changes made to the language!