Code Monkey home page Code Monkey logo

ide's Introduction

文言 wenyan-lang

npm build Netlify Status

English | 简体中文 | 繁體中文

文言文編程語言。A programming language for the ancient Chinese. Try it online.

CHANGELOG

之世,結繩而足治,屈指而足算。是時豈料百代之後,計算機械之巧,精於公輸木鳶,善於武侯流馬;程式語言之多,繁若《天官》之星宿,奇勝《山經》之走獸。,或以速稱。,各爭文采。方知鬼之所以夜哭,天之所以雨粟。然以文言編程者 ,似所未有。此誠非文脈之所以傳,文心之所以保。嗟予小子,遂有斯志。然則數寸之烏絲猶覆於頭,萬卷之素書未破於手;一身長羈於遠邦,兩耳久曠于雅言。然夫文章者吾之所宿好,程式者偶承時人之謬譽。故希孟不慚年少,莊生不望無涯。乃作斯言。誠未能嘔瀝長吉心血,亦庶幾免於義山流沫。既成之後,復學干將鑄劍而自飼,越王嚐糞而當先。自謂偶追《十書》之筆意,但恨少八家之淋漓。此子山所謂士衡撫掌而甘心,平子見陋而固宜。然則雖實覆甕之質,尚存斧正之望;雖乏呂相之金,易字之渴蓋同。此亦開源之大義,吾輩之所以勉勵也。一笑。

Helloworld

Wenyan:

吾有一數。曰三。名之曰「甲」。
為是「甲」遍。
	吾有一言。曰「「問天地好在。」」。書之。
云云。

Equivalent JavaScript:

var n = 3;
for (var i = 0; i < n; i++) {
	console.log("問天地好在。");
}

Output:

問天地好在。
問天地好在。
問天地好在。

Punctuations and newlines are completely optional (just like they are in Classical Chinese), so the above code is equivalent to:

吾有一數曰三名之曰「甲」為是「甲」遍吾有一言曰「「問天地好在」」書之云云

More sophisticated examples, such as the Sieve of Eratosthenes, Quicksort, Mandelbrot set, and Tower of Hanoi, can be found in the ./examples folder.

Features

Try it out

Text Editor Plugins

Command Line Compiler

Install the compiler by

npm install -g @wenyan/cli

Try run the included examples, e.g.:

wenyan examples/helloworld.wy
# will output: 問天地好在。

You can now translate JavaScript to wenyan-lang using the wenyanizer by zxch3n.

3rd Party Compilers

Documentation

Check out our Wiki pages

Contributors

Code Contributors

This project exists thanks to all the people who contribute. [Contribute].

Financial Contributors

Become a financial contributor and help us sustain our community. [Contribute]

Individuals

Organizations

Support this project with your organization. Your logo will show up here with a link to your website. [Contribute]

ide's People

Contributors

akira-cn avatar antfu avatar jacoblincool avatar lingdong- avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

ide's Issues

Proposal: Themes Support

Themes could make the IDE more customizable for programmers' personal preferences, we could also include some popular themes like Monokai, Solarized Dark/Light, etc built-in for users to choose. (and also configurable for embedding)

I propose this format, it could be a simple js object or even store as JSON.

{
   background: "#fff",
   foreground: "#111",
   primary: "red",
   secondary: "rgba(23,14,45,0.4)",
   // ...
}
// If the provided fields are incomplete, they will fall back to the default values.

Furthermore, we could have some metadata as well

{
  name: "Wenyan Dark",
  author: "Wenyan Team",
  isDark: true,
  theme: {
    background: "black",
    foreground: "#fff",
    primary: "red",
    secondary: "rgba(23,14,45,0.4)",
    // ...
  }
}

By this, we can also get rid of the "dark mode" hack since it also inverts the colors in the output canvas which may be kinda confusing for painting.

When we grow a number of themes, we could also generate themes for CodeMirror and Prism.js that can be directly pulled from CDN in https://github.com/wenyan-lang/highlight

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.