Skip to content

LMauricius/ChakraL-experiment

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ChakraL-experiment

New language experiment. Absolutely unstable currently. The documentation is WIP, and the compiler only for basic syntax testing.

Directory structure

  • Compiler - Source code of the ChakraL compiler
    • bin - Executable compiler frontend and some junk
    • lib - ChakraL libraries, can be used in various executbles
    • ChakraLC - compiler frontend source code
    • libChakraL - compiler library source code
      • generators - Python scripts for generating the compiler
      • include - headers to include in your project
      • src - C++ sources corresponding to headers in /include
      • syntaxdef - Text files describing the ChakraL syntax and other recipes for compiler generation
      • autoinclude - Autogenerated .h files
      • autosrc - Autogenerated .cpp files
      • autosyntaxdef - Autogenerated syntax files, from manual syntax files
      • ctre - Awesome compile-time regex library by hanickadot, https://github.com/hanickadot/compile-time-regular-expressions
  • Examples - ChakraL code examples and ideas
  • Tools - Random useful scripts for designing

Language documentation

The documentation is part of this repo. It can be built by running the compile.py script inside the Docs directory. The current documentation can be viewed using Github's htmlpreview

Building from source

This project uses CMake for building the sources. To compile the compiler, position yourself inside the Compiler/ directory, create the build/ directory, position yourself inside the build directory, and then run the following:

cmake ../
cmake --build . --target ChakraLC

Using the compiler

Currently, the compiler is only meant for testing the parsing stage. You can run the compiler by calling the chakral executable with the .ckrl file as the only argument. The program will list the source file's Tokens and the semantic node structure. For example, running ./chakral ../../Examples/shortTest.ckrl from the bin/ directory might output:

Lexer finished in 2.0875e-05s
0 IDENTIFIER-1,1: a
1 CHANGE-1,3: 
2 NUM_LIT-1,5: 2
3 MUL-1,6: 
4 IDENTIFIER-1,7: b
5 NL-1,9: 
6 END_OF_STR-2,1: 
Parser finished in 0.000330794s
    'desc': AssignmentEqual {
        'left': Identifier {
            'name': IDENTIFIER-1,1: a
        }
        'operator': AssignmentEqualOperator {
            'op': CHANGE-1,3: 
        }
        'rights': ExprBinaryL2R {
            'operands': ValueLiteral {
                'val': NUM_LIT-1,5: 2
            }
            'operands': Identifier {
                'name': IDENTIFIER-1,7: b
            }
            'operator': MUL-1,6: 
        }
    }
0 errors found:

About

New language experiment

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages