Comments (12)
Cmc.Ast.Dump
from cm-document.
statement list:
variable declaration [recurFunc]:
type:
lambda type [(i8)->i8]
initialize expression:
lambda:
type:
lambda type [(i8)->i8]
parameters:
variable declaration [a]:
type:
primary type [i8]
initialize expression:
null expression
body:
statement list:
return statement:
function call expression:
receiver:
variable expression [recur]:
type:
lambda type [(i8)->i8]
parameters:
variable expression [a]:
type:
primary type [i8]
type:
i8
variable declaration [gg]:
type:
primary type [i8]
initialize expression:
null expression
assignment statemnt:
lhs:
variable expression [gg]:
type:
primary type [i8]
rhs:
function call expression:
receiver:
variable expression [recurFunc]:
type:
lambda type [(i8)->i8]
parameters:
literal expression [233]:
primary type [i8]
type:
primary type [i8]
assignment statemnt:
lhs:
variable expression [gg]:
type:
primary type [i8]
rhs:
function call expression:
receiver:
variable expression [recurFunc]:
type:
lambda type [(i8)->i8]
parameters:
literal expression [233]:
primary type [i8]
type:
primary type [i8]
from cm-document.
debug 我都是直接上调试器的,用的很爽
from cm-document.
不是啊,字符位置什么的,参考sourcemap的实例
from cm-document.
字符位置啥意思?行号什么的都有好好保留的
from cm-document.
/- -/不仅仅行号啊,例如说
(stacktrace from Node.js REPL)
> global.resfjdorgjdiojdjrgnklsdjghuisdhdofer() TypeError: global.resfjdorgjdiojdjrgnklsdjghuisdhdofer is not a function at repl:1:8 /- HERE !-/ at ContextifyScript.Script.runInThisContext (vm.js:44:33)
from cm-document.
哦,我刚刚在吃火锅的时候在廖雪峰的博客里面看了下source map是啥。这个可能得做一会去了,我最近写代码的时间比较少。
可以考虑 @thautwarm
from cm-document.
字符位置也需要确定?token那步可能直接丢弃一些字符的。
我个人觉得metainfo就足够了。toJS是指toJSON吗?if so, 并不困难,Parser那步就能完成,比如我这边这个
Stmt[Expr[BinOp[Factor[Atom[Literal[Name [' f ']]
LP [' ( '] Expr[BinOp[Factor[Atom[Literal[Name [' a ']]
LP [' ( '] Expr[BinOp[Factor[Atom[Literal[Name [' b ']]
]
]
]
]
RP [' ) ']]
]
]
]
RP [' ) ']]
]
]
]
]
转JSON就是
{"stmt":{"expr":
"<以下省略...字>"
}
}
然后debug我也是直接用这个,加上parser步骤的一些过程信息,例如解析上述代码的部分过程信息:
Name <= Name [' a ']
RET
RET
Literal <= Literal[Name [' a ']]
RET
RET
(Closure | Literal) <= (Closure | Literal)[Literal[Name [' a ']]
]
(Closure | Literal) <= (Closure | Literal)[Literal[Name [' a ']]
]
Trailer WITH [(0, 'AWAIT'), (0, 'LINESPLIT'), (0, 'Expr'), (0, 'BinOp'), (0, 'Factor'), (0, '(Op)*'), (0, 'Atom'), (0, '(Closure | Literal)'), (0, 'Literal'), (0, 'Name'), (1, 'Trailer'), (1, 'LP'), (2, '(Expr)*'), (2, 'Expr'), (2, 'BinOp'), (2, 'Factor'), (2, '(Op)*'), (2, 'Atom'), (2, '(Closure | Literal)'), (2, 'Literal'), (2, 'Name'), (3, 'Trailer')]
Trailer WITH [(0, 'AWAIT'), (0, 'LINESPLIT'), (0, 'Expr'), (0, 'BinOp'), (0, 'Factor'), (0, '(Op)*'), (0, 'Atom'), (0, '(Closure | Literal)'), (0, 'Literal'), (0, 'Name'), (1, 'Trailer'), (1, 'LP'), (2, '(Expr)*'), (2, 'Expr'), (2, 'BinOp'), (2, 'Factor'), (2, '(Op)*'), (2, 'Atom'), (2, '(Closure | Literal)'), (2, 'Literal'), (2, 'Name'), (3, 'Trailer')]
LP <= LP [' ( ']
from cm-document.
但是你这个是Python血的
from cm-document.
@ice1000 马上就有C#版本了。只要一个语言有列表就好了(逃
from cm-document.
/- -/都是大大啊
是咋样丢弃的- -总之出现错误时对了就好
from cm-document.
在tokenize那一步就把字符位置存下来就是了,tan$π/2
from cm-document.
Related Issues (20)
- Some advice and questions about language features HOT 12
- Syntax sugar when there's only one lambda parameter HOT 1
- about object and classes HOT 1
- about traits and interfaces HOT 10
- About macros HOT 6
- What exactly is "string"? HOT 12
- Do we really need object-oriented features? HOT 5
- Allow force noinline HOT 10
- About digit literals HOT 3
- About operators HOT 3
- Notepad++ syntax highlight HOT 4
- About pointers HOT 4
- Allow non-lambda overloading HOT 6
- About LiteralExpression HOT 2
- About foreign function interfaces HOT 10
- For-each syntax sugar HOT 9
- Syntax sugar for simple lambda expressions HOT 2
- String literals HOT 1
- About modules HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cm-document.