2439905184 / 2439905184/Simple-language

箭头符号的意思

Open
#4 2 comments 0 reactions 1 assignee Claimed by @2439905184 View on GitHub
enhancement help wanted 草案
Dominant language
Java
Stars
0
Forks
0
PR merge metrics
No merged PRs in 30d

Description

自创关键字

一个逐字符扫描器的伪代码
从lox语言学习的例子
```nim
func scanToken()
{
//扫描字符串并连接字符到字符串Token
var my_string = ""
while (peek() != '"' and not isAtEnd())
{
get_next_char() -> my_char
my_string += my_char
}
}
```
将以上代码写在一起
```gdscript
func scanToken()
{
var my_string=""
while (peek() != '"' and not isAtEnd())
{
get_next_char() -> my_char --> my_string += my_char
}
}
```
->符号例子的伪代码 形象直观
```gdscript
func scanToken()
{
var my_string=""
while (peek() != '"' and not isAtEnd())
{
get_next_char() -> my_char
my_string += my_char
}
}
func main()
{
func compile()
{
while (not Tokenizer.isAtAnd())
{
scanTokens() -> tokens:array --> writeTokens(tokens)
}
}
func execute(){}
compile() --> execute()
}
// 显示指定默认运行的主函数,如果不指定,则为默认的main
//boot是关键字 表示程序的入口
//此处使用三个大于号避免和移位操作符混淆
/* 所有与箭头有关的操作符
-> 把左边函数运算完的值存入右边的变量
--> 不换行继续运行代码,
>>> 用于boot关键字的右边,表示从程序入口调用哪个函数启动程序
特地使用不超过三个箭头符号 易于记忆,形象直观
*/
boot >>> main()
// 程序从入口启动时调用某个类的某个函数
boot >>> MyClass.my_main()
```

Contributor guide

No contributing guide indexed for this repository

Research direction

The issue proposes new arrow operators (->, -->, >>>) for a simple language. The repository is in Java, but the examples are in Nim and GDScript. Start by examining the existing scanner/tokenizer in the codebase to understand the current syntax. The goal is to design and implement these operators, which requires defining their semantics, updating the parser, and likely the interpreter. Check if there are existing tests for the scanner to see how new tokens are added.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
15/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.