Creating a parser for a simple pseudocode language?

前端 未结 3 539
没有蜡笔的小新
没有蜡笔的小新 2020-12-20 00:58

I wanted to make a simple parser, for a \"pseudo code\" like language(kept rigid), in Java. A sample pseudo code would be -

//This is a comment
$x1 = readi         


        
3条回答
  •  北海茫月
    2020-12-20 01:37

    For simple languages (this is a judgement call, and if you are inexperienced you may not be able to make that call correctly), one can often write a recursive descent parser by hand that does well enough. The good news is that coding a recursive descent parser is pretty straightforward.

    If you aren't sure, use overkill in the form of the strongest parser generator you can get.

提交回复
热议问题