gittech. site
for different kinds of informations and explorations.
JavaScript but It's Ancient Chinese
ζθ¨θ½ζε¨ Wenyanizer
Introduction
Inspired by the great Wenyan Lang project, which compile ancient Chinese Language to javascript code, I build this project to do the opposite thing -- to parse javascript to Wenyan.
Usage
Install wenyanizer. Run
yarn add wenyanizer
Import and use it in your project
import {js2wy} from 'wenyanizer';
// Or use it in node.js
// const {js2wy} = require('wenyanizer');
js2wy("while(true){console.log('ε¦δΉ ')}")
// Output: 'ζηΊζ―γ\n εΎζδΈθ¨γζ°γγε¦δΉ γγγ\n ζΈδΉγ\nδΊδΊγ\n'
Play Online
VSCode Plugin by antfu
You can use Wenyanizer in Wenyan Lang VSCode plugin now.
Examples
Basic Grammars
for(var _rand = 0; _rand < 100; _rand++){
console.log("ε");
while(true){
var ε€©ε½ = Math.random();
if (ε€©ε½ < 0.5){
break
}
}
}
// ηΊζ―δΈηΎιγ
// εΎζδΈθ¨γζ°γγεγγγ
// ζΈδΉγ
// ζηΊζ―γ
// εΎζδΈθ‘γεδΉζ°γεγ
// 欲θ‘ζ―θ‘γεΏ
ε
εΎ
// δΉθ‘ζ―θ‘ζ°γ
// δΉεΎ Math.random()
// ζ―θ¬γεγδΉθ‘δΉγ
// ζ½γεγ
// εδΉζ°γ倩ε½γγ
// θ₯γ倩ε½γε°ζΌιΆεδΊεθ
γ
// δΉζ’γ
// δΊδΊγ
// δΊδΊγ
// δΊδΊγ
Wrapping JS Native Function Call
var ζ΅θ― = JSON.stringify(100);
var δΉ = JSON.stringify({});
// εΎζδΈθ‘γεδΉζ°γεγ
// 欲θ‘ζ―θ‘γεΏ
ε
εΎδΈη©γζ°γ_a0γγ
// δΉθ‘ζ―θ‘ζ°γ
// δΉεΎ JSON.stringify(_a0,)
// ζ―θ¬γεγδΉθ‘δΉγ
//
// ζ½γεγζΌδΈηΎγ
// εδΉζ°γζ΅θ―γγ
// εΎζδΈη©γεδΉζ°γδΈγ
// ζ½γεγζΌγδΈγγ
// εδΉζ°γδΉγγ
Wrapping Nested Structure
var η² = 100 % 99;
var δΉ = 100 * 200 + 35 * (48 - 10) * η²;
// ι€δΈηΎδ»₯δΉεδΉγζι€εΉΎδ½γ
// εδΉζ°γη²γγ
// δΉδΈηΎδ»₯δΊηΎγ
// εδΉζ°γε―
γγ
// ζΈεεε
«δ»₯δΈεγ
// δΉδΈεδΊδ»₯ε
Άγ
// εδΉζ°γηΈγγ
// δΉγηΈγδ»₯γη²γγ
// ε γε―
γδ»₯ε
Άγ
// εδΉζ°γδΉγγ
Hacks
Restricted by current Wenyan grammar, some hacks are required to make this compiler work. When you use grammar that is not well supported by Wenyan, there will be a bunch of functions being added to the top of the compiled file.
Wenyan is still evolving fast, thanks to the devoted author and the great community. We may not need to hack anymore very soon.
You can check the full list of polyfills in HACKS.md.
Roadmap
Name | Status |
---|---|
JS Code Compiled From Wenyan | β |
Closure | β |
Control: While/For/If/Else | β |
Object var a = {a: 0, b: 1, c: 2} |
β |
Array [[[0 ,2], [2, []]]] |
β |
+-*/ |
β |
--, ++, +=, -=, /= |
β |
Distinguish a++ and ++a |
β |
Wraping global object when necessary, such as Math , JSON |
β |
console.log |
β |
a.b = 3 |
β |
NewExpression | β |
Function | β |
this keyword |
β |
a[b] = 3 |
β |
ForOfStatement | β |
Wenyan Lib | WIP |
Wenyan Nested Function Call | β |
Optimize Curried Function | β |
RegExp | β |
switch | β |
bit op | β |
null undefined |
β |
DebugExpression | β |
WithStatement | β |
continue |
β |
debug exp | β |
ForInStatement | β |
throw try...catch...finally | β |
Modules (import, export, require) | β |
=== (will be compiled to == ) |
β |
let & const (will be compiled to var ) |
WON'T FIX |
es6 ^ (Class, Promise, yield, await...) | WON'T FIX |
Earn $100 Fast: AI + Notion Templates
Do you want to make extra money quickly? This guide shows you how to create and sell Notion templates step by step. Perfect for beginners or anyone looking for an easy way to start earning online.
Why Download This Guide?
- Start Making Money Fast: Follow a simple process to create templates people want and will buy.
- Save Time with AI: Learn to use tools like ChatGPT to design and improve templates.
- Join a Growing Market: More people are using Notion every day, and they need templates to save time and stay organized.
Includes Helpful Tools:
- ChatGPT Prompts PDF: Ready-made prompts to spark ideas and create templates faster.
- Checklist PDF: Stay on track as you work.
Whatβs Inside?
- Clear Steps to Follow: Learn everything from idea to sale.
- How to Find Popular Ideas: Research trends and needs.
- Using AI to Create: Tips for improving templates with AI tools.
- Making Templates User-Friendly: Simple tips for better design.
- Selling Your Templates: Advice on sharing and selling on platforms like Gumroad or Etsy.
- Fixing Common Problems: Solutions for issues like low sales or tricky designs.
Who Is This For?
- Anyone who wants to make extra money online.
- People who love using Notion and want to share their ideas.
- Creators looking for a simple way to start selling digital products.
Get your copy now and start making money today!
π° Want to Earn 40% Commission?
Join our affiliate program and start making money by promoting well crafter prodicts! Earn 40% on every sale you refer.
π Sign up as an affiliate here: Become an Affiliate