Coder Social home page Coder Social logo

lnsp / tea-python Goto Github PK

View Code? Open in Web Editor NEW
2.0 3.0 0.0 231 KB

DEPRECATED! Python implementation of the Tealang runtime.

Home Page: https://tealang.github.io/tea

License: MIT License

Python 99.91% Batchfile 0.02% Shell 0.07%
scripting-language scripting python tea minimalistic minimalist-design

tea-python's Introduction

Tea

Build Status

Careful! This project is deprecated and no longer in development. Refer to the Go implementation for a more recent version.

Code written in Tea is simple and small, even Tea itself is short (less than 3000 lines of code). It was crafted for reading, extending and maintaining.

How about a little taste of Tea?

// tasty.tea
import std.io;

func greet(greeting, name: string): string {
    return "%s, %s!" % [greeting, name];
}

io.println("You called", args.join(","));
io.print("Please enter your name: ");
var name: string = io.readln();

if (length(trim(name)) == 0) {
    io.println("Ok, I won't greet you :(");
} else {
    io.print("How many times? ");
    var times: int = io.readln();
    
    for (i: int = 0; i < times; i += 1) {
        print(greet("Hello", name));
    }
}

tea-python's People

Contributors

lnsp avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

tea-python's Issues

String lexing does not work correctly

For example

#> "hello \" world" + 3
==================
Expected: string("hello \" world"), whitespace( ), operator(+), number(3)
Got: string("hello \" world" + 3)

Add support for iteration loops

Support for loops like for (init; cond; iter) { body } is needed. This loop structure can be broken down into the following subcomponents:

init
loop (cond)
  sequence
    body
    iter

Add tests for parser module

Tested modules are

  • is_assignment
  • find_matching_block
  • find_matching_prt
  • get_arg_count
  • get_precedence
  • is_left_associative
  • generate_expression
  • generate_declaration
  • generate_assignment
  • generate_function
  • generate_if
  • generate_while
  • generate_for
  • generate_sequence
  • optimize_ast
  • generate

Rename tokenizer

Lexer is the correct term for its functionality and it is shorter than 'tokenizer'.

Add basic types

Types

  • Integer
  • Float
  • Boolean
  • String
  • Function
  • Null
  • List
  • Map
  • Set

All of these types have to be added to enable the creation of more complex types like structs.

Improve lexer string handling

At the moment the lexer does not support escape codes. This means you are not able to encode double quotes, newlines etc.

Add standard operators

Add high priority operators from the specification to the Standard Runtime Environment.

High priority

  • #add
  • #sub
  • #mul
  • #div
  • #asgn Note: moved from operator to AST node
  • #equ

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.