Help us understand the problem. What is going on with this article?

"Writing An Interpreter In Go " を JavaScriptで実装してみる その2 Parser

More than 1 year has passed since last update.

Writing An Interpreter In Go " を JavaScriptで実装してみる その1 Lexer
に引き続き 夏休みの個人的課題を進めています
Writing An Interpreter In Goの103ページまで読み進めました
ほぼ動いてないけど(特定の構文は理解できず無限ループするようです^^;)
かなりバギー
[parser 部分のcode]
https://github.com/freddiefujiwara/saru/blob/master/src/parser.js

現時点のコードカバレッジ

-------------------------|----------|----------|----------|----------|-------------------|
File                     |  % Stmts | % Branch |  % Funcs |  % Lines | Uncovered Line #s |
-------------------------|----------|----------|----------|----------|-------------------|
All files                |    96.02 |    82.38 |    95.24 |    95.95 |                   |
 block_statement.js      |      100 |       50 |      100 |      100 |                12 |
 boolean_literal.js      |      100 |        0 |      100 |      100 |                19 |
 call_expression.js      |       80 |        0 |       60 |    77.78 |              9,15 |
 expression.js           |      100 |      100 |      100 |      100 |                   |
 expression_statement.js |      100 |      100 |      100 |      100 |                   |
 function_literal.js     |      100 |        0 |      100 |      100 |                15 |
 identifier.js           |      100 |      100 |      100 |      100 |                   |
 if_expression.js        |    78.57 |       50 |       40 |    76.92 |          10,16,22 |
 infix_expression.js     |      100 |    16.67 |      100 |      100 |             28,33 |
 integer_literal.js      |      100 |      100 |      100 |      100 |                   |
 let_statement.js        |      100 |      100 |      100 |      100 |                   |
 lexer.js                |      100 |      100 |      100 |      100 |                   |
 node.js                 |      100 |      100 |      100 |      100 |                   |
 parser.js               |    93.75 |    83.91 |      100 |    93.75 |... 39,342,349,384 |
 prefix_expression.js    |      100 |        0 |      100 |      100 |                26 |
 program.js              |      100 |      100 |      100 |      100 |                   |
 return_statement.js     |      100 |      100 |      100 |      100 |                   |
 statement.js            |      100 |      100 |      100 |      100 |                   |
 token.js                |      100 |      100 |      100 |      100 |                   |
-------------------------|----------|----------|----------|----------|-------------------|   

インストール方法はこちら

npm i -g saru

新しい使い方はこちら

  $ saru
Hello fumikazu! This is the Monkey programming language!
Feel free to type in commands
* Please type 'bye' if you want to exit
>>>

こんな構文が理解できます

>>> 1 + 2 * 3
(1 + (2 * 3))
>>>
1 * 2 - 3
((1 * 2) - 3)
>>>
false == 1
(false == 1)

またLexerだけを使いたい場合は -l オプションつければLexerモードで起動します

  $ saru -l
Hello fumikazu! This is the Monkey programming language!
Feel free to type in commands
* Please type 'bye' if you want to exit
>>>

さて次はいよいよ Evaluation 18日までに終わるかな

rakuten
楽天グループは、「イノベーションを通じて、人々と社会をエンパワーメントする」ことをミッションとしています。ユーザーや取引先企業へ満足度の高いサービスを提供するとともに、多くの人々の成長を後押しすることで、社会を変革し豊かにしていきます。「グローバル イノベーション カンパニー」であり続けるというビジョンのもと、企業価値・株主価値の最大化を図ってまいります。
https://corp.rakuten.co.jp/
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした