Code Monkey home page Code Monkey logo

kaiserthe13th / tr-lang Goto Github PK

View Code? Open in Web Editor NEW
10.0 3.0 1.0 377 KB

A language that tries to be syntactically similar to Turkish | Türkçe'ye yakın bir sözdizimine sahip olmaya çalışan bir dil

Home Page: https://tr-lang-docs.netlify.com/english

License: MIT License

Rust 86.07% Shell 0.49% CSS 1.08% HTML 0.16% JavaScript 4.77% TypeScript 3.50% Python 3.40% Vim Script 0.53%
programming-language rust lexer parser bytecode made-with-love turkish turkish-language turkiye turkce

tr-lang's Introduction

tr-lang

Fast and Easy


GitHub license GitHub issues GitHub stars GitHub release (latest by date) GitHub release (latest by date including pre-releases) Crates.io Visual Studio Marketplace Version PyPI Platforms GitHub branch checks state Tests

Made with ❤️ in 🇹🇷

tr-lang is a language that aims to bring programming language syntax closer to Turkish. tr-lang has half-stack, half-regional based approach to memory management. tr-lang syntax has become infix from postfix starting with 0.4.0-rc1.

View in Turkish

🚩 Table of Contents

🏆 What Has Been Implemented?

✔️ All parts of the language seems like they are done!

✔️ tr-lang lexer seems like its done Issue #1

✔️ tr-lang parser is in progress Issue #2

✔️ tr-lang bytecode seems like its done Issue #3

✔️ tr-lang bytecode reader seems like its done Issue #4

✔️ tr-lang runtime seems like its done Issue #5

🚀 Installation

🪟 Windows

📇 Pre-Compiled Executable

For windows there is a pre-compiled binary. Just download it, extract the zip and you are ready to go!

Note: This binary won't be in the PATH environment variable by default meaning it won't be globally usable across the system with 'tr-lang'

If you want to add tr-lang to your PATH environment variable you can follow this tutorial by Ryan Hoffman

📦 Cargo

$ cargo install tr-lang

⚙️ Build from source

dependencies: rust, cargo

$ git clone https://github.com/kaiserthe13th/tr-lang
$ cd tr-lang
$ cargo install --path .

Note: If you just want to play you can change the last command to cargo build --release your file will be in target/release/tr-lang

🍎 MacOS

🍺 Homebrew

$ brew tap kaiserthe13th/tr-lang
$ brew install tr-lang

📦 Cargo

$ cargo install tr-lang

⚙️ Build from source

dependencies: rust, cargo

$ git clone https://github.com/kaiserthe13th/tr-lang
$ cd tr-lang
$ cargo install --path .

Note: If you just want to play you can change the last command to cargo build --release your file will be in target/release/tr-lang

🐧 Linux

🗃️ Debian Package

  1. Go to the Releases tab and download tr-lang_<x.x.x>_amd64.deb
  2. In the Terminal
$ dpkg -i tr-lang_<x.x.x>_amd64.deb

Note: On some linux systems just clicking or doubke clicking on the file would start install

🎩 RPM Package

  1. Go to the Releases tab and download tr-lang_<x.x.x>.x86_64.rpm
  2. In the Terminal
$ rpm -i tr-lang_<x.x.x>.x86_64.rpm

Note: On some linux systems just clicking or doubke clicking on the file would start install

🍺 Homebrew

$ brew tap kaiserthe13th/tr-lang
$ brew install tr-lang

📦 Cargo

$ cargo install tr-lang

⚙️ Build from source

dependencies: rust, cargo

$ git clone https://github.com/kaiserthe13th/tr-lang
$ cd tr-lang
$ cargo install --path .

Note: If you just want to play you can change the last command to cargo build --release your file will be in target/release/tr-lang

💻 Editor Support

VS Code Sublime Atom Vim/Neovim Emacs
Highlighthing With tr-lang Extension Planned No With tr-lang.vim No
Snippets With tr-lang Extension No No No No

Note: Feel free to help!

🤝 Contributing

To report bugs, suggest new features or update documentation use the issue tracker

for features use (enhancement | yükseltme) tag, for bugs use (bug) tag and for documentation updates use (documentation | dökümantasyon) tag

👍 Bugfix PR's are welcome!

🔮 Plans For Future

  • Rust-like implemented structs
  • Actual Lists
  • Interpolated Strings
  • Package Manager (planned to be named one of Trileche, Trill, Tren or Trial)

📜 Thanks

  • I give my thanks to user Netwave from stackoverflow.com for helping fix a bug during the creation of the parser.
  • I give my thanks to user Chayim Friedman from stackoverflow.com for helping me with closure magic during the making of UnknownIdentifier error message.

tr-lang's People

Contributors

kaiserthe13th avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

songlinshi

tr-lang's Issues

Interpolated Strings in tr-lang

Many other high-level languages have Interpolated strings, even some not so high-level languages have them (Crystal). So tr-lang should also have Interpolated strings. This comes along with a syntax proposal for such strings.

&"var = {var}"
# interpolates var into the string

or

(var)"var = {fmt}":fmt
# formats var into string with var:__fmt

Note: The 2nd proposal depends on #31

Welcome to tr-lang Discussions! | tr-lang tartışmalarına hoş geldiniz!

Discussed in #7

Originally posted by kaiserthe13th October 16, 2021

👋 Welcome!

We’re using Discussions as a place to connect with other members of our community. We hope that you:

  • Ask questions you’re wondering about.
  • Share ideas.
  • Engage with other community members.
  • Welcome others and be open-minded. Remember that this is a community we
    build together 💪.
  • Join the forms and polls we will send you!

To get started, comment below with an introduction of yourself and tell us about what you do with this community.

👋 Hoşgeldiniz!

Biz Tartışmalara topluluğumuzdaki diğer kişilerle bağlanmak için kullanıyoruz. Sizin:

  • Merak ettiğiniz soruları sormanızı.
  • Fikirlerinizi paylaşmanızı.
  • Topluluğun diğer üyeleri ile konuşmanızı.
  • Diğerlerine saygılı davranın ve açık görüşlü olun. Topluluğumuzu birlikte yapacağımızı unutmayın 💪.
  • Size yolladığımız form ve anketlere katılmanızı!
    umuyoruz

Başlamak için, aşağıya kendinizi tanıtan bir yorum atın ve bu topluluk hakkında ne düşündüğünüzü söyleyin.

Multivariable assignment and destructuring

so another syntax proposal I have is this simple syntax that is very effective
and much more user friendly than x, y -> a -> b (which will result in a = y, b = x)

# sets a = 1, b = 2
1, 2 |a, b| ile

# can be used as a way of expecting function arguments
işlev name |a, b| ile
  ...
son

# we can implement for .. in loops easily
[1, 2, 3, 4, 5] için |i| ile
  ...
son

# Destructuring

# Get first element of list
[1, 2, 3, 4] |[a, ..]| ile

# Get a and b from a block
blok c
  1 -> a
  2 -> b
son

c |{a, b}| ile

it can also be used as a way of bringing multiple things into scope

yükle ".." -> a
a |b, c, d| ile

In the background it would probably function as taking elements from the stack in reverse order
for pattern destructuring it would probably be destructure objects with curly braces
for list destructuring it would again reverse order and take
meanwhile .. means reverse order again and can only be used once

Lists in the language

Add lists to the language

Syntax Proposal:

  • [x y z a b c]
    Nested:
  • [x y [ z a b ] c]

Rust-like structs(without types) with implementations in tr-lang and Basic Enums

A proposal to add Rust-like structs(without types) to the language. As in Turkish struct means yapı, which also means building. It may be a confusing name. Thus after some consideration I renamed them to şekil (shape). Enums have been directly translated into sayım. And here is the syntax proposal. methods are metot or yöntem and new is yeni

# A struct
şekil Human
  name
  age
  gender
son
# An enumeration
sayım Gender
  male female # at runtime assigned to 0 and 1
  # or instead of at runtime we turn it into this
  # blok Gender
  #   0 -> male
  #   1 -> female
  # son
  # thus enums can also be compared with numbers
son
# With this syntax you can only implement things in scope
metot is-male >> Human # methods have self thrown into them as a value when executed
  :gender = Gender:male ver
son
# Creating a member function that doesn't take self
bağlı işlev new-human >> Human -> gender -> age -> name
  yeni Human # initializer keyword: yeni
    name age gender
  son ver
son

Type casting in tr-lang

I suggest the @<type> operator which will turn the last element on stack to <type>

In action will look like this:

girdi@sayı

This will turn the input into a sayı

What should be the name for the language? | Dilin adı ne olmalı?

EN:
What would you like it to be?
It has been decided that the languages name will stay tr-lang as nobody gave a response that was found great by us.

TR:
Ne olmasını isterdiniz?
Dilin adının tr-lang kalacağına karar verilmiştir. Çünkü hiç kimse tatmin edici bir cevap vermedi.

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.