/jane

An integer processing programming language, basically an advance integer calculator. Built for learning purposes

Primary LanguageC

Introduction
============

Jane is my first real quasi-real programming which will
at least be usefull in some contexts and also introduce 
at least one of my own unique constructs which I have
borrowed and refined from other languages.


Jane is built with flex and bison, with the backend coded
in C, and it currently compiles to C.

The Jane language is basically a glorified calculator, or
what ever you want to call a language that ONLY OPERATES
on integers. The intent is to allow simple input, integer 
operations and output.

If its not yet clear, Jane is currently a crystallization of
lots of tutorials over the years, so I need a simple goal 
to make me simply push out a programming language first.

After jane, I hope to make a more full featured language.

But first... jane :)



Language Constructs 
======================
Comments:
# Start from the hash sign and run
# till the end of a line


Declaration:
    a := 1;
    b := 5;

Assignment:
    a = a + 1;
    b = a + 3;

Expressions:
    a + 1 * 3 / 4;

Operators:
    + - * / % ^
    > < == >= <= !=
    || && !

Input:
    read a;
    read b;
    read "A prompt for the read:> " a

Output:
    print a;
    print 5 * 3;
    print x - 5 * 33;

    print "A label for the print: " a + b;
    
    print "Printing just the label";



Conditionals:

    if expression {
        statements
    } 

    if expression {
        statements
    } else {
        statements
    }

Loops:
    max := 50;
    i := 0;

    while true {
        if i >= max {
            stop;
        }

        i = i + 1;

        if i % 2 == 0 {
            print "even number: " i;
            next;
        } 

        if i % 5 == 0 {
            print "multiple of 5: " i;
            next;
        }
    }

// Use stop and next to replace break and stop in loops

Functions:
    // declaration

    fun fun_name(a, b, c) {
    }

    // There must be at least
    // fun main() {} defined to get
    // a proper running program
    fun main (){
    }

    // call
    fun_name(param, param, param);



New Ideas:
/*

   the match statement is under contruction
   and is going to be the preferred conditional
   work horse
   
   
match sum % 2 {
    0 {
        print "sum is even";
    }

    1 {
        print "you have a remainder of 1";
    }
     
    any {
        print "you have at least one match";
    }

    none {
        print "none of your options matched";
    }
}

statement_match:
    TOK_MATCH expression TOK_OBRACE
        match_clauses
    TOK_EBRACE
    ;

match_clauses:
    match_clause match_clauses
    |
    match_clause;

match_clause:
    expression TOK_OBRACE statements TOK_EBRACE
    | 
    TOK_ANY TOK_OBRACE statements TOK_EBRACE
    |
    TOK_NONE TOK_OBRACE statements TOK_EBRACE
    ;
*/