ram-nad / ANTLR-Based-Transpiler

A transpiler for converting a extremely small subset of Chapel to C.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

A Small Transpiler using ANTLR4

This is a small transpiler made for changing a extremely minimal (it does not even support if, else, loops) subset of Chapel Language to C. This is a toy project. Made with the purpose of learning ANTLR. No guarantee is made in any way about correctness of the Transpiler. (It may be completely wrong also. Again this was made for learning purpose and a very limited timeframe.)

ANTLR Grammar Files can be found under grammar folder. This project uses Visitors for working with parse trees. The code for visitor can be found under visitor folder.

Currently implemented constructs:

  • Functions

  • Records (Very Minimal, Treating them similar to structs in C)

  • Methods

  • Variable Declaration

  • Cast Expression

Example

This Code has been used to transpile test.chpl to output.c.

About

A transpiler for converting a extremely small subset of Chapel to C.


Languages

Language:C++ 97.8%Language:ANTLR 1.6%Language:C 0.4%Language:Chapel 0.2%