Files
femcode/docs/README.md

8.7 KiB

Femcode Language Documentation

Femcode is a femboy-themed programming language designed to be simple, expressive, and fun. It features a unique syntax inspired by femboy terminology, making coding an adorable experience.

Table of Contents

  1. Getting Started
  2. Basic Syntax
  3. Variables and Assignment
  4. Data Types
  5. Operators
  6. Control Flow
  7. Functions
  8. Comments
  9. Input/Output

1. Getting Started

To run Femcode programs, you can use the femterpreter wrapper script. This script simplifies running your .fem files without needing to navigate to the src directory or explicitly call python3 main.py.

Running Femcode Programs

Once you have the femterpreter script, you can run your Femcode programs like this:

./femterpreter examples/your_program.fem

Or, if you add femterpreter to your system's PATH or create an alias (recommended for convenience):

femterpreter examples/your_program.fem

To use femterpreter from any directory, you can either add it to your system's PATH or create a shell alias.

Option 1: Add to PATH

  1. Open your shell's configuration file (e.g., ~/.bashrc, ~/.zshrc, or ~/.profile).

  2. Add the following line, replacing /path/to/femboy-coding-language with the actual absolute path to your femboy-coding-language directory:

    export PATH="/path/to/femboy-coding-language/femcode:$PATH"
    
  3. Save the file and restart your terminal or run source ~/.bashrc (or your respective config file).

Option 2: Create an Alias

  1. Open your shell's configuration file (e.g., ~/.bashrc, ~/.zshrc, or ~/.profile).

  2. Add the following line, replacing /path/to/femboy-coding-language with the actual absolute path to your femboy-coding-language directory:

    alias femterpreter="/path/to/femboy-coding-language/femcode/femterpreter"
    
  3. Save the file and restart your terminal or run source ~/.bashrc (or your respective config file).

2. Basic Syntax

Running Femcode Programs

Once you have the femterpreter script, you can run your Femcode programs like this:

./femterpreter examples/your_program.fem

Or, if you add femterpreter to your system's PATH or create an alias (recommended for convenience):

femterpreter examples/your_program.fem

To use femterpreter from any directory, you can either add it to your system's PATH or create a shell alias.

Option 1: Add to PATH

  1. Open your shell's configuration file (e.g., ~/.bashrc, ~/.zshrc, or ~/.profile).

  2. Add the following line, replacing /path/to/femboy-coding-language with the actual absolute path to your femboy-coding-language directory:

    export PATH="/path/to/femboy-coding-language/femcode:$PATH"
    
  3. Save the file and restart your terminal or run source ~/.bashrc (or your respective config file).

Option 2: Create an Alias

  1. Open your shell's configuration file (e.g., ~/.bashrc, ~/.zshrc, or ~/.profile).

  2. Add the following line, replacing /path/to/femboy-coding-language with the actual absolute path to your femboy-coding-language directory:

    alias femterpreter="/path/to/femboy-coding-language/femcode/femterpreter"
    
  3. Save the file and restart your terminal or run source ~/.bashrc (or your respective config file).

2. Basic Syntax

2. Basic Syntax

Femcode uses keywords inspired by femboy terminology. Code blocks are defined using Femboycore to start a block and Periodt to end it.

3. Variables and Assignment

Variables are declared and assigned values using the is keyword.

my_variable is 10
my_name is "Femboy"

4. Data Types

Numbers

Femcode supports integer numbers.

my_number is 123

Strings

Strings are sequences of characters enclosed in double quotes.

my_string is "Hello, world!"

Booleans

Femcode has two boolean values: Kawaii (True) and Cringe (False).

is_cute is Kawaii
is_bad is Cringe

Lists

Lists are ordered collections of items, enclosed in square brackets [] and separated by commas.

my_list is [1, "apple", Kawaii]

Elements can be accessed using zero-based indexing:

UwU Boy my_list[0] # Prints 1

Dictionaries

Dictionaries are unordered collections of key-value pairs, enclosed in curly braces {}. Keys and values are separated by a colon :, and pairs are separated by commas.

my_dict is {"name": "Femboy", "version": 1.0}

Values can be accessed using dot notation (property access):

UwU Boy my_dict.name # Prints "Femboy"

5. Operators

Arithmetic Operators

Femcode supports standard arithmetic operations:

  • + (addition)
  • - (subtraction)
  • * (multiplication)
  • / (division)
result is 10 + 5 * 2
UwU Boy result # Prints 20

Comparison Operators

Used for comparing values:

  • == (equal to)
  • != (not equal to)
  • > (greater than)
  • < (less than)
  • >= (greater than or equal to)
  • <= (less than or equal to)
UwU Boy 5 == 5 # Prints Kawaii
UwU Boy 10 < 5 # Prints Cringe

Logical Operators

Used for combining boolean expressions:

  • and (logical AND)
  • or (logical OR)
  • not (logical NOT)
UwU Boy Kawaii and Cringe # Prints Cringe
UwU Boy Kawaii or Cringe # Prints Kawaii
UwU Boy not Kawaii # Prints Cringe

6. Control Flow

Conditional Statements (If/Else)

Use Femboy Feminine for if and Androgyny for else to control program flow based on conditions.

my_age is 20
Femboy Feminine my_age > 18 Femboycore
    UwU Boy "You are an adult femboy!"
Periodt
Androgyny Femboycore
    UwU Boy "You are a young femboy!"
Periodt

Loops (While)

Use Otokonoko for while loops to repeatedly execute a block of code as long as a condition is true.

counter is 0
Otokonoko counter < 5 Femboycore
    UwU Boy counter
    counter is counter + 1
Periodt

7. Functions

Defining Functions

Functions are defined using the Femboy keyword, followed by the function name, optional parameters in parentheses, and a code block enclosed by Femboycore and Periodt.

Femboy say_hello() Femboycore
    UwU Boy "Hello from function!"
Periodt

Femboy add_numbers(a, b) Femboycore
    Femme a + b
Periodt

Calling Functions

Functions are called by their name followed by parentheses, enclosing any arguments.

say_hello()
result is add_numbers(10, 5)

Return Values

Use the Femme keyword to return a value from a function.

Femboy get_kawaii_status() Femboycore
    Femme Kawaii
Periodt

status is get_kawaii_status()
UwU Boy status # Prints Kawaii

Built-in Functions

Femcode provides several built-in functions for common tasks:

  • ask(prompt): Prompts the user for input and returns it as a string.

    name is ask("What's your name, femboy? ")
    UwU Boy "Hello, " + name + "!"
    
  • len(value): Returns the length of a string or a list.

    my_string is "Cute"
    my_list is [1, 2, 3]
    UwU Boy len(my_string) # Prints 4
    UwU Boy len(my_list) # Prints 3
    
  • type(value): Returns the type of a value as a string (e.g., "int", "str", "list", "dict", "bool").

    UwU Boy type(123) # Prints "int"
    UwU Boy type("hello") # Prints "str"
    UwU Boy type(Kawaii) # Prints "bool"
    

8. Comments

Single-line comments start with a # symbol. Anything after # on the same line is ignored by the interpreter.

# This is a single-line comment
UwU Boy "Hello, Femcode!" # This is also a comment

9. Input/Output

Input is handled via the ask built-in function, and output is handled via the UwU Boy (print) command.

name is ask("Enter your name: ")
UwU Boy "Your name is: " + name