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

Lime sexp parser #2

Open
2 tasks
duangsuse opened this issue Mar 21, 2018 · 0 comments
Open
2 tasks

Lime sexp parser #2

duangsuse opened this issue Mar 21, 2018 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@duangsuse
Copy link
Contributor

Parser

  • RSpec tests
  • Parser
() 是 nil, 展开时 look-ahead 判断(且长度为 0 的list 展开时会被展开为 nil) (但是, `( )` 就是空列表)
(abcd_efg ) sexp 中第一项永远只能是 Symbol 或 sexp
(sym_bol)
((symbol ()) ()) [[:symbol, []], nil]
('' ) `'` 到 `'` 之间的部分是 Symbol, 但如果括号中第三个字符(`'` 后面那个)是空白字符,`'` 视为普通符号

字符串语法:
'abc_defg "abc defg"
'abc_defg' "abc defg"
(以 `'` 起始,以空白字符或 `'` `)` 终止,之间的 _ 视为空白字符)
"abcdefg" "abcdefg"
"abcdefg #{a}" (+ "abcdefg " a)
"abcd #{b} efg" (+ "abcd " (+ b " efg"))
(以 `"`起始,以 `"` 终止,之间支持 `#{}` 简写 )

符号语法:
:a (: a)
:'abc' :abc
:"abc" :abc

填充语法:
#t true
#f false
#n nil
#g 1
#e 0
#l -1
#h 新建 Hash 对象
#i 新建 List 对象(空 s-表达式)

数字语法:
032
434
23.2
0x1
0b1
0o1
0x123i32
0x32f64
数字以 0-9 起始,以空白字符或 ) 结束

表达式其他地方出现的任何不以
' " 0-9 # : ( 开头的都作为符号,以空白字符或 ) 终止```
@duangsuse duangsuse added the enhancement New feature or request label Mar 21, 2018
@duangsuse duangsuse self-assigned this Mar 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant