Skip to content

LLVM front-end for the Lexy2 programming language

Notifications You must be signed in to change notification settings

AleksyBalazinski/lexy2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lexy2

Compiler for my programming language. The language reference can be viewed here.

Building the project

Note that this will download and build the ANTLR runtime so it will take a while to build the project for the first time.

mkdir build
cd build
cmake ../ -G "Unix Makefiles" # specify a sane generator for Windows
cmake --build .
./lexy2

CMake is configured to call ANTLR so no further action here is needed. The code generated by ANTLR will be in libs directory.

ANTLR can also be called manually with

antlr4 grammar/Lexy2.g4 -Dlanguage=Cpp -listener -o libs

Sidenote:

When building on Windows with GCC using these official guidelines you may encounter this error (at least that's what happened to me): No rule to make target 'antlr4_runtime/src/antlr4_runtime/runtime/Cpp/runtime/libantlr4-runtime.a'. To solve it I modified cmake/ExternalAntlr4Cpp.cmake as suggested by Giampiero here.

My environment

  • gcc.exe (Rev10, Built by MSYS2 project) 12.2.0
  • cmake version 3.25.0
  • GNU Make 4.4.1. Built for Windows32

Debugging

launch.json for VS Code Cmake tools extension taken from here.

Testing

Functional

python ./validate.py

The script compiles and runs the .l2 files in the examples directory and compares their output with corresponding expected.txt files.

Unit

ctest --test-dir build