PokeScript

View project on GitHub

logo

PokeScript

A compiler for the language PokeScript

Welcome to PokeScript, the language designed to help Pokemon trainers learn to code their very own PokeDex. Beginner trainers can quickly and easily implement their own PokeDex using PokeScripts features.

Created by George Harrison

PokeScript Features

  • Inspired by JavaScript and Python
  • Pokemon Themed
  • Static typing
  • Object oriented
  • Type Inference

PokeTypes

Javascript PokeScript
boolean capture (success/fail)
String pokestring
Number pokedollar (int)
Number pokefloat (float)

Data Structures

JavaScript PokeScript
Array pokelist
Map pokedex

Examples

Javascript PokeScript
console.log(“Hello world”)
pika “Hello world”
Javascript PokeScript

var x = 1
const x = 1

poke x = 1
const x = 5
Javascript PokeScript

function add(a, b) {
    return a + b
}

ability add(pokedollar a, pokedollar b) {
    return a + b
}
Javascript PokeScript

if (x == 5) {
    return 5
} else if (x == 4) {
    return 4
} else {
    return 2
}

catch x == 5 {
    pika 5
} release catch x == 4 {
    pika 4
} release {
    pika 2
}
Javascript PokeScript

for (int x = 3, x < 5; x++) {
    break;
}

evolve pokedollar x = 3 until 5 {
    break
}
Javascript PokeScript

while (true) {
    var x = 1
}

while success {
    poke x = 1
}
Python PokeScript

dex = {
    "pikachu": 3,
    "charizard": 6,
    "snorlax": 8
}
{pokestring, pokedollar} dex = {"pikachu": 3, "charizard": 6, "snorlax": 8}
Javascript PokeScript

class Pokemon {
    constructor(level, name) {
        this.level = level
        this.name = name
    }
    getLevel() {
        return this.level
    }
}

train Pokemon {
    starter(pokedollar level, pokestring name) {
        this.level = level
        this.name = name
    }
    getLevel() {
        return this.level
    }
}
Javascript PokeScript
// comment
ϞϞ(๑⚈ ․̫ ⚈๑)∩ comment

Types of Semantic Errors

  • Using non-initialized variables
  • Bad types in all ternary, binary, and unary operations
  • Bad types in data structures
  • Bad type in reassignment of variable
  • Bad type in declaration of variable
  • Incorrect number of function params
  • Breaking outside of loop
  • Returning outside of function
  • Function with return value doesn’t return anything
  • Calling a function or method that is not intialized
  • For loop with non-integer iterator