JavaCC is one such compiler generator. Here are key points about JavaCC.
- It can generate both scanner and parser.
- TopDown parsing: generate the parse tree in a top-down manner.
- It generates Recursive Descent parsers. The parser will execute a set of recursive methods to process the input (not based on parse tables)
- Predictive (non-backtracking). It looks ahead a number of symbols to decide which grammar rule to use.
- Supports LL(K) grammars. That means there must not be left recursion, and the grammar should be left refactored.
- Detects left-recursion, possible ambiguities and warns during compiler generation.
- Can use different look-ahead values in different local sections
- Can use syntactic look-ahead. Hence can be considered as a LL(*) parser generator.
- Gammar can be provided in EBNF notation. Removing left recursion is easy and the grammar is more readable.
- Provides debugging support: tokenizing / parsing / looking ahead.
- Supports panic-mode error recovery.
- Supports Unicode.
- Lots of good documentation / resources to follow.
- Good tooling support, including an Eclipse plugin, IntelliJ IDEA plugin and a Maven plugin.
Here is my attempt to create a compiler in my own language, සිංහල (Sinhala). This uses a simplified version of c grammer.
https://github.com/amilamanoj/CMinus/
1 comment:
Interesting topic for a blog. I have been searching the Internet for fun and came upon your website. Fabulous post. Thanks a ton for sharing your knowledge! It is great to see that some people still put in an effort into managing their websites. I'll be sure to check back again real soon.
http://heavyrentals.equipment
Post a Comment