Currently i am working on developing a parser in JavaScript that parses Haskell Language.I am studying Esprima.JS and will like to build on top of it that will parse Haskell Language.As per my understanding i need to start with a basic parts such numbers(how they are used in Haskell language) Operators and then advance options.I am very new to it any help with resources will work for me
I am following this pattern from Esprima.js
Token={
//Haskell
PosToken:10
//Should i have to declare all tokens of Haskell over here
};
TokenName={};
TokenName[Toke.PosToken]='PosToken';
//Should i have to all tokens of Haskell Overhere
FnExprTokens=[//Assignment and other operators];
Syntax={
//Haskell Expressions
HsExp:'HsExp',
HsStmt:'HsStmt',
HsFieldUpdate: 'HsFieldUpdate',
//and so on for other expression types
};
PropertyKind={};
//Error Messages
Messages={
};
Regex={};
Should i follow this process or improve on other things.Will the flow be the same if i want to build upon Esprima.js(http://esprima.org/). Esprima.js is easy to follow along then acorn.js(Although less lines of code and little bit faster).I want to parse Haskell to Mozilla AST format.Any help will be appreciated.