Code Monkey home page Code Monkey logo

gelic's Introduction

Gelic

A dynamically-typed, C-based syntax programming language. Supports arithmetic operations, conditional statements, and loops. Written in Python 3.

Usage

  1. Clone or download this repository.

  2. Navigate to project's root directory.

  3. On the terminal, run the command below to start the Gelic interactive mode:

    • python3 .\gelic.py

    To run an external .txt file execute the command below. A test folder is provided for sample programs:

    • python3 .\gelic.py .\test\fib.txt

Data Types

  • Booleans:
    • true; // not false
    • false: // not *not* false
  • Numbers:
    • Gelic has only one kind of number: floating point.
    • 1234; // evaluated as 1234.0
    • 12.34; // float
  • Strings:
    • Gelic strings are enclosed in double quotes.
    • "Gelic uses double quotes for strings."
    • "";
    • "123";
  • Nulls:
    • Gelic uses the nil keyword to represent "no value".

Expressions

  • Arithmetic:
    • Gelic supports basic arithmetic operations just as C does.
    • The minus operator is both used as in infix and a prefix. '-' can be used to negate a number:
      • -2;
  • Comparison and Equality:
    • Gelic also supports comparison operators:
      • 3 < 4; // true
      • 3 <= 3; // true
      • 6 > 10; // false
      • 6 >= 7; // false
      • 1 == 2: // false
      • "cat" != "dog"; // true
  • Logical Operators:
    • The not operator, a prefix !, returns false if its operand is true, and vice versa.
      • !true; // false
      • !false; // true
    • and and or logical operators, identical with C's && (and) and || (or)
      • true and false; // false
      • true and true; // true
      • false or false; // false
      • true or false; // true
  • Precedence and grouping
    • Gelic's operators have the same precedence and associativity as C.
      • var average = (min + max) / 2;

Statements

  • Print
    • print evaluates a single expression and displays the result to standard output. Syntax is similar to Python 2.
      • print "Hello, world"; // Hello, world

gelic's People

Contributors

garthzx avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.