8

GitHub - redstar/m2lang: The LLVM-based Modula-2 compiler

 1 year ago
source link: https://github.com/redstar/m2lang
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

m2lang - The LLVM-based Modula-2 compiler

Introduction

See this FOSDEM 2019 talk for some details.

Implementation decisions

  • LLVM is only external dependency
  • CMake scripts derived from clang
  • ISO Modula-2 language first
  • Use "declare-before-use" (single-pass) model
  • Goal is target several platforms from the beginning

Current status

  • The lexer is done.
  • The preprocessor (for handling of directives) is is based on the draft technical report "Interfacing Modula-2 to C", Annex B and aims to be compatible to the Macintosh p1 compiler. Parsing of directives is implemented, with mostly no functionality.
  • The parser is based on ISO Modula-2 with generic and OO additions. Some LL(1) conflicts are still left in the grammar, so not every source is parsed correctly.
  • The parser is generated by LLtool. A C++ port of LLtool is now integrated into this project, but not yet enabled.
  • Error recovery in the parser is based on "panic mode", using the follow sets of the current and the active callers.
  • The AST nodes will be generated by new tool ASTtool.
  • Error messages are outputted using llvm::SourceMgr for nice presentation.
  • Only a dummy driver exists to see the parser in action.
  • A couple of IR statements is emitted to the console after succesful parsing.

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK