Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

设计上看起来很别扭的问题 #6

Open
leobert-lan opened this issue Jan 29, 2022 · 1 comment
Open

设计上看起来很别扭的问题 #6

leobert-lan opened this issue Jan 29, 2022 · 1 comment

Comments

@leobert-lan
Copy link
Owner

是的,目前的设计看起来很别扭。

从核心设计看,用了解释器模式。诚然,我尝试定义了一种新的表达式语法,并且存在大量的非终结符,然而,终结符却没有给出”显而易见“的代码定义。

以一个简单的例子对比下:

解释(计算)”1+2“,

使用解释器模式时,”+“ 将作为非终结符表现,其含义在内部封装,解释时产生实质作用。 1、2是终结符,笼统的讲,终结符表达的是实际的内容或上下文中内容的代号。

在Davinci中,终结符可以是:尺寸、颜色等。

而别扭的地方正在于此。Android中的尺寸和颜色等也有大量的定义方式,尺寸还有各种单位,它不像”1、2“这种数值一样纯粹;并且很难不适合 直接加载到解释器上下文中。早期版本的设计中并没有理会这一点!

leobert-lan pushed a commit that referenced this issue Jan 29, 2022
@leobert-lan
Copy link
Owner Author

TODO:迭代中文法发生了改变,细化文法,将颜色、尺寸等终结符剥离出来

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant