Skip to content

ProjektBarium - a compiler for my programming language barium

License

Notifications You must be signed in to change notification settings

satyajitghana/ProjektBarium

Folders and files

NameName
Last commit message
Last commit date

Latest commit

b221bb4 · Apr 9, 2020

History

56 Commits
Mar 31, 2020
Feb 24, 2020
Apr 7, 2020
Apr 9, 2020
Mar 31, 2020
Jan 3, 2020
Apr 1, 2020
Mar 31, 2020
Jan 2, 2020
Mar 30, 2020
Mar 31, 2020
Mar 30, 2020
Apr 1, 2020
Mar 31, 2020
Apr 1, 2020
Mar 31, 2020
Jan 10, 2020
Jan 10, 2020
Mar 31, 2020
Mar 31, 2020

Repository files navigation

Projekt Barium - A Basic Compiler for Barium Programming Language

This is the compiler i built for my programming lanugage barium, a fun little project to understand compilers.

Tech Stack : Flex, Bison, LLVM

Build Status

ubuntu-build

Status

language-count top-language repo-size loc-count

release-date release license maintainer

The Compiler Recipe

Lexical Analyzer (Lex) -> Semantic Parsing (Bison) -> Assembly (LLVM) -> Executable

Task List

  • Add Data Types (decimal, fraction)
  • Operators, Symbols, Reserved Keywords
  • Add Looping Statements - ongoing (parse done)
  • Add Control Statements - ongoing (parse done)
  • Add Output Statements - uses vprintf
  • Add Input Statements
  • Add Arrays Support - ongoing (parse done)
  • Create a CI/CD Pipeline
  • Output executables instead of obj files (partial support)
  • locations (YYLTYPE, and @$)

Far-fetched task list

  • Make it a Library
  • Add Boost Math Support
  • Containerize the Compiler using Docker

Dependencies

  • LLVM 9.0.1
  • Bison 3.5.2
  • Flex 2.6.4

Known Issues

  • Spacing is required between operators to remove ambiguity

Build Barium (Installs Deps)

$ sudo sh build.sh

Run Tests

$ sh run_tests.sh

Example Run

Normal Run

$ ./barium test_files/test_all_ir.bar -v OFF

Debug Verbose Run

$ ./barium test_files/test_all_ir.bar -v INFO

Screenshot

help

Compiler Recipe

compiler-recipe

Example AST

Run binary-op-test

AST binary-op-test-ast