Giter Site home page Giter Site logo

stepfenshawn / cantonese Goto Github PK

View Code? Open in Web Editor NEW
1.1K 13.0 45.0 2 MB

粤语編程語言.The Cantonese programming language.

Home Page: https://cantonese-community.github.io/

License: MIT License

Python 89.98% Ruby 4.07% Rust 5.94%
programming-language cantonese-language python3 cantonese compiler

cantonese's Introduction

Coding
I'm a Code Ninja 🥷. Building cool stuff forhumans​.

cantonese's People

Contributors

hfhchan avatar laubonghaudoi avatar nobodxbodon avatar satinwukerorig avatar sherlockcxk avatar stepfenshawn 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  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  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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cantonese's Issues

個 README 可唔可以用粵語寫?

隻嘢好好玩😆不過作爲一隻粵語編程語言,個 README 自己就應該帶頭寫粵文先啱𠿪。用普通話寫 README 顯得好唔正經。

本人对此语言的一些提议

可以向C++学习,把Cantonese语言变成一种标准,而不仅仅是一个解释器。建议创建一个新repo,用于存放core文件的内容。建议取名为CppCantonese。
若得到你的允许,我可以自己创建这个 repo,并且帮你把core移植到里面来。

含中文标识符时报错信息有误

#32 时注意到的:

畀我睇下 某 点样先?
=> 濑嘢!请先定义‘endprint’再使用
畀我睇下 x某 点样先?
=> 濑嘢!请先定义‘x’再使用

没有做参数检查

python3 cantonese.py
Traceback (most recent call last):
File "cantonese.py", line 702, in
main()
File "cantonese.py", line 690, in main
with open(sys.argv[1], encoding = "utf-8") as f:
IndexError: list index out of range

繁體輸入支持

衆所周知除左廣東之外,港澳亦使用粵語并且用繁體字書寫文字,可考慮增加選擇繁/簡選項

疑问

本人看到您在如何运行中讲到,“Cantonese 语言运行喺 Python 虚拟机上,环境净系支持 Python3,因为噉先符合广东人先进嘅**!”,但阅读源码后发现您说的所谓的虚拟机运行是先将cantonese转成py,然后执行py代码。但本人理解的虚拟机运行是用interpreting的方式运行.cantonese,而不是“transpiler”。所以说您这个“虚拟机运行”其实不算真正的虚拟机运行,但我相信您早就明白,因为之前本人问过类似的问题
这个问题出现的原因是您还没有完成虚拟机的开发,提前写到readme里的吗?还是本人理解有误?
谢谢!

`six` package dependency error

Hello, after installing Cantonese, it fails to run because of the import six that isn't included in your list of dependencies.

import six

Cantonese/setup.cfg

Lines 31 to 34 in 4870538

install_requires=
setuptools >= 0.7.0
pygame >= 1.9.4
Kivy >= 2.0.0

You only support Python 3 in setup.cfg and the README, so it doesn't look like you would need six for Python 2 interoperability.

python_requires = >=3.6

It doesn't seem like you are using six at all. Can we delete the import six line?

% Cantonese
Traceback (most recent call last):
  File "/Users/dosentmatter/.pyenv/versions/3.9.6/bin/Cantonese", line 5, in <module>
    from src.cantonese import main
  File "/Users/dosentmatter/.pyenv/versions/3.9.6/lib/python3.9/site-packages/src/cantonese.py", line 12, in <module>
    from src.stack_vm import *
  File "/Users/dosentmatter/.pyenv/versions/3.9.6/lib/python3.9/site-packages/src/stack_vm.py", line 9, in <module>
    import six
ModuleNotFoundError: No module named 'six'

The workaround is to pip install six, but this shouldn't be necessary.

请问如何运行测试?

在根目录下运行 src/test.py 未遍历所有例程:

$ python src/test.py 
==============START TEST================
=============END=======================
Finished in 0s!

另外,为自动验证运行结果,像 木兰重现项目之前这样 获取进程输出后与期望值作比较如何?

The plans for Cantonese 1.0.8

今日啱好得閒上 gayhub, 睇到 Cantonese 好耐未更新了, 所以未來幾日準備 Update 呢個 repo, 升級到 Cantonese 1.0.8...

Cantonese 1.0.8 主要更新計劃:

  • 語言前端用 cython 構建方便以後於底層 llvm 交互
  • 關鍵字冚唪唥轉換成繁體處理 (keywords.py 實在太大喇)
  • 優化代碼改Bug, 提高成個語言嘅穩定性

print / return 语句

“畀我睇下 |变量| 点样先?”
print 语句太长啦,直接用 “睇下 |变量|” 得唔得?

“返转头” 太过 return 直译,用 “返回” 又冇咩意思…… “还数” 好似几唔错。

vm if语句原理

今天好好研究了一下虚拟机里的if语句,但好像不太能理解,您能笼统地解释一下这个if的工作原理吗?
万分感激!(^-^

太难了

学习编程学英文,没想到还得在学个广东话,😀

原理

本人是一名初中生,现在也在做自己的编程语言,叫rickroll-lang(求star啦)。来这里是为了借鉴并学习大佬的语言的。
不过现在我有个问题,这个语言是把.cantonese源码转换成python源码执行的吗?还有我不太清楚use_tradtion这个变量是干什么的。
谢谢!

Is the interactive interpreter (REPL) supposed to work?

  • Running any statement does not seem to do anything.
  • The only way to exit is to kill the program with CTRL+C, 收工 doesn't work.
% Cantonese 
早晨!
> 畀我睇下 " Hello World! " 点样先?
> 
> 收工
> 
> Traceback (most recent call last):
  File "/Users/dosentmatter/.pyenv/versions/3.9.6/bin/Cantonese", line 8, in <module>
    sys.exit(main())
  File "/Users/dosentmatter/.pyenv/versions/3.9.6/lib/python3.9/site-packages/src/cantonese.py", line 3125, in main
    sys.exit(开始交互())
  File "/Users/dosentmatter/.pyenv/versions/3.9.6/lib/python3.9/site-packages/src/cantonese.py", line 3089, in 开始交互
    交互().cmdloop("早晨!")
  File "/Users/dosentmatter/.pyenv/versions/3.9.6/lib/python3.9/cmd.py", line 126, in cmdloop
    line = input(self.prompt)
KeyboardInterrupt

命令与参数的母语化

刚看到 to_web 等参数 (complie 好像是拼写笔误?),不妨考虑也母语化,比如 木兰重现里用的

 --版本,         -版   显示版本
 --python变木兰, -兰   将 Python 源码转换为木兰源码
 --语法树,       -树   语法树信息

对了在 pypi 发布的时候可以把命令也母语化,像这样:

    entry_points = {
        "console_scripts": ['木兰 = 木兰.中:中']
        },

就可以运行 $ 木兰 了。

vm代码注释

今天研究了一下vm的代码,但没有注释有点难懂,特别是那几个变量,不知道是用来干什么的。
谢谢啦!

添加命令行下交互环境

不用创建源码文件,感觉比较方便试用。运行 python src/cantonese 即进入交互环境如何?

木兰自带的 交互环境功能 供参考。我先搞一个最基本功能的 pr 你看看?

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.