标点符号的常见含义
我正在编写自己的语法,并且想要在该语法中没有明显常见含义的字符 [1]。是否有 标点符号 字符的常见含义列表(例如 '?'
可能是三元运算符的一部分,或正则表达式的一部分),以便我可以尝试选择那些可能没有“明显”语法的内容(我可以对此进行判断:-)。
[1] 它实际上是一种扩展的 Fortran FORMAT,但细节与这里无关
I'm writing my own syntax and want characters that do not have obvious common meanings in that syntax [1]. Is there a list of the common meanings of punctuation characters (e.g. '?'
could be part of a ternary operator, or part of a regex) so I can try to pick those which may not have 'obvious' syntax (I can be the judge of that :-).
[1] It's actually an extended Fortran FORMAT, but the details are irrelevant here
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这是对跨语言语法的详尽调查。
Here is an exhaustive survey of syntax across languages.
我不愿意如此失败,但这听起来确实有点像它不存在(跨语言的所有符号/运算符的列表)快速浏览一下可以很好地了解常见的内容。
假设您将自己限制为 ASCII,那么候选列表或多或少就是您在键盘上看到的内容,我可以想到其中大多数的一些用途。所以也许避免冲突有点雄心勃勃。当然这取决于谁是这个语法的使用者,如果例如 Fotran 中相对不使用的符号是合适的,那就更现实了。
此链接:Fotran 95 Spec 给出了 Fortran 的列表运算符,如果避免的话可能会有所帮助。
如果这些内容是显而易见的陈述或遗漏了要点,或者只是没有太大帮助,我很抱歉:)
I am loath to be so defeatist, but this does sound a bit like it doesn't exist ( a list of all the symbols / operators across languages ) a quick look around would give a good idea of what is commonplace.
Assuming that you will restrict yourself to ASCII, the short-list is more or less what you can see on your keyboard and I can can think of a few uses for most of them. So maybe avoiding conflicts is a bit ambitious. Of course it depends on who is to be the user of this syntax, if for example symbols that are relatively unused in Fotran would be suitable then that is more realistic.
This link: Fotran 95 Spec gives a list of Fortran operators, which might help if avoided.
I'm sorry if any of this is a statement of the obvious or missing the point, or just not very helpful :)
例如,我想说 [az][AZ] All 都没有明显的语法。如果您使用大写 T 作为运算符。
x T v
缺点是人们喜欢使用字母来表示变量。
除此之外,您可能想研究多字符运算符,但它们的缺点是,
它们很快就会厌倦键入诸如scalar = vec4i *+ vec4j
如果您可能有一个融合乘加运算符, 之类的内容。好吧,这个还不错,但我相信你可以找到更麻烦的。
I would say [a-z][A-Z] All do not have an obvious syntax for instance. if you used Upper case T as an operator.
x T v
The downfall is people like to use letters for variables.
Other than that you might want to investigate multicharacter operators, the downfall of these however is that they quickly grow weary to type things like
scalar = vec4i *+ vec4j
if you perhaps had a Fused multiply add operator. Well that one isnt so bad, but I'm sure you can find more cumbersome ones.