Giter Club home page Giter Club logo

Comments (11)

bjutfgxqzn avatar bjutfgxqzn commented on July 26, 2024 3

徐老师关于此问题的回复:在实验题目的测试数据示例中,运算符(+,>),关键词(while)都没有属性(属性为无)。这样定义是可以的,但更鼓励进行实验时由后续语法分析的需要来重新定义单词种别及属性。

from compiler.

hanliutong avatar hanliutong commented on July 26, 2024

返回值INT

表示种别:需要定义各个种别的整型值
int scan(char* input)

全部变量

表示单词属性:需要定义全局变量存储单词属性

例子

种别 属性
INT10 0
INT10 92
+ _
IDN data
> _
INT16 63
INT8 0
WHILE _

from compiler.

hanliutong avatar hanliutong commented on July 26, 2024

@Jakob1357 语法分析中对词法分析器的种别和属性的需求大概是?

from compiler.

Jakob1357 avatar Jakob1357 commented on July 26, 2024

@hanliutong 目前来看,我觉得需要的属性有三类数字,返回的是三种int型的值;标识符,返回一个类。感觉关键字和+,-这样的关键字和运算符暂时可以无属性。如果行不通可以再讨论。

from compiler.

bjutfgxqzn avatar bjutfgxqzn commented on July 26, 2024

@Jakob1357 标识符返回的是它本身吗?比如说上面韩柳彤发的例子中输入数据"data"的属性就为data。

from compiler.

Jakob1357 avatar Jakob1357 commented on July 26, 2024

@bjutfgxqzn 你是说返回的是个字符串吗?

from compiler.

bjutfgxqzn avatar bjutfgxqzn commented on July 26, 2024

@Jakob1357 是的

from compiler.

WDDcat avatar WDDcat commented on July 26, 2024

我在想有没有必要以宏定义的形式把接口返回的种别单独定义在一个头文件里 @bjutfgxqzn @hanliutong

from compiler.

hanliutong avatar hanliutong commented on July 26, 2024

类似于#define INT10 10?我感觉好像确实会优雅一点 @WDDcat

from compiler.

WDDcat avatar WDDcat commented on July 26, 2024

对对对,这样代码可读性也强一些 @hanliutong

from compiler.

hanliutong avatar hanliutong commented on July 26, 2024

int NUM = 0; INT8 INT10 INT16属性的全局变量

string IDN_NAME; 标识符属性的全局变量

宏定义

from compiler.

Related Issues (11)

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.