Writing a basic compiler frontend following LLVM's tutorial, with complete added supports Hindi and UTF-8 in general

Overview

सारस | SARAS

Started with following LLVM's tutorial

In development, a hobby project only

JIT is broken right now, 'jit' branch par code hai uska Compiler work kar raha hai

To actually try, or see usage with sample programs, go to the programs/ directory after building :)

S -> Sai

A -> Abhay

R -> Rabin

A -> Aditya Gupta

S -> Salman

Building

First install cmake (to build C++ project) & llvm (IR to machine code)

cmake -B build
cmake --build build

Install

cmake --install build

Use

./build/saras --help
Usage: SARAS [options] 

Optional arguments:
-h --help       shows help message and exits
-v --version    prints version information and exits
-l --lexer      Stop at Lexer, only print Tokens read [default: false]
-p --parser     Stop at Parser stage, saves Abstract Syntax Tree in graph*.png files [default: false]
-ir             Stop at IR stage, prints LLVM Intermediate Representation for all expressions and functions [default: false]
--interactive   DEFAULT, provides an interactive console to type [default: true]

उदाहरण | Examples

# प्रकर मतलब प्रक्रिया

प्रकर विरहंक(क)
    यदि क < 1 तब
        1
    अथवा
       क*विरहंक(क-1)

विरहंक(5)

Tokens

Virhanka Numbers

aka Factorials

# virhanka.saras

fn virhanka(n)
    if n < 1 then
        1
    else
        n*virhanka(n-1)

virhanka(5)

Generated with graphviz, code in visualizer.hpp

Graph

Generated LLVM IR:

Generated with llvm-as < t.ll | opt -analyze --enable-new-pm=0 -view-cfg

Graph

Todo

Happy Diwali

Issues
  • [ImgBot] Optimize images

    [ImgBot] Optimize images

    Beep boop. Your images are optimized!

    Your image file size has been reduced by 58% 🎉

    Details

    | File | Before | After | Percent reduction | |:--|:--|:--|:--| | /graphs/graph1.png | 37.44kb | 15.35kb | 59.00% | | /graphs/graph3.png | 71.62kb | 29.82kb | 58.37% | | /graphs/graph.png | 71.62kb | 29.82kb | 58.37% | | /graphs/graph0.png | 20.74kb | 8.65kb | 58.28% | | /graphs/graph2.png | 42.50kb | 19.65kb | 53.76% | | | | | | | Total : | 243.92kb | 103.29kb | 57.65% |


    📝 docs | :octocat: repo | 🙋🏾 issues | 🏪 marketplace

    ~Imgbot - Part of Optimole family

    opened by imgbot[bot] 0
Owner
Aditya Gupta
A simple student
Aditya Gupta
Model of the classic Ibanez Tube Screamer 808 using Nodal Analysis and WDF with a few new features added!

TS-808-Ultra Model of the classic Ibanez Tube Screamer 808 using Nodal Analysis and WDF with a few new features added! Download Windows vst3 and Mac v

James Stubbs 44 Mar 29, 2022
header-only UTF-8 string functions based on STL-string

utf8_xxx header-only UTF-8 string functions based on STL-string size_t utf8_len(const std::string& _Str) std::string utf8_sub(const std::string& _Str,

Voidmatrix 2 Dec 27, 2021
Following Automotive Open System Architecture (AUTOSAR)

Following Automotive Open System Architecture (AUTOSAR), Diagnostic Communication Manager Module Implemented over Communication Stack Based on AUTOSAR Specification Document (SWS) Release 4.3.1 Classic Platform, ISO-14229 Standard (Road Vehicle Unified Diagnostic Services (UDS)) and ISO-15765 (Road Vehicle Diagnostics on Controller Area Network (CAN)).

null 7 Jun 17, 2022
Provenance - An iOS & tvOS Frontend for Multiple Emulators

iOS & tvOS multi-emulator frontend, supporting various Atari, Bandai, NEC, Nintendo, Sega, SNK and Sony console systems…

Provenance Emu 4.9k Jul 2, 2022
Deluxe68 - A simple register allocator frontend for 68k assembly

Deluxe68 Deluxe68 is a simple (stupid) register allocator frontend for 68k assembly. It is a source to source translator, so you'll need your regular

Andreas Fredriksson 33 Nov 4, 2021
A single header C++ wasm frontend library leveraging Emscripten

Livid Livid is a single header C++ wasm frontend library leveraging Emscripten. Usage The code looks something like this: #include "livid/livid.hpp" #

Mohammed Alyousef 16 Jun 22, 2022
Small commandlet for generating a complete project using UE4SS header dump, Project File and Plugin Manifest

UE4GameProjectGenerator Small commandlet for generating a complete project using UE4SS header dump, Project File and Plugin Manifest Usage Compile the

null 5 Jun 19, 2022
CredBandit - Proof of concept Beacon Object File (BOF) that uses static x64 syscalls to perform a complete in memory dump of a process and send that back through your already existing Beacon communication channel

CredBandit CredBandit is a proof of concept Beacon Object File (BOF) that uses static x64 syscalls to perform a complete in memory dump of a process a

anthemtotheego 160 Jun 17, 2022
A complete Javascript environment for creating homebrew applications and games on PlayStation 2.

AthenaEnv is a project that seeks to facilitate and at the same time brings a complete kit for users to create homebrew software for PlayStation 2 using the JavaScript language.

Daniel Santos 17 May 18, 2022
LineaMeteoStazione is a complete weather station

LineaMeteoStazione is a complete weather station which can be interfaced with professional sensors from Sensirion as well as some Davis Instrument component (Rain Gauge, Anemometer) The project is aimed as DIY weather station but just requiring the assembly part, because the boards will already be given programmed by me as well as the complete PCB. The code will be shared Opensource for the people who wants to try to do it from the beginning or modify it!

Eugenio 14 Aug 18, 2021
Complete roadmap for your placement or intern preparation!

?? Placement-Preparation- Complete Roadmap ?? This repository consists of all the necessary Resources,questions and their solutions required for crack

Sumit Ojha 246 Jun 25, 2022
sour is a complete multiplayer Sauerbraten experience in the web delivered as a single Docker image.

sour sour is a complete multiplayer Sauerbraten experience in the web delivered as a single Docker image. Overview I have always loved playing Sauerbr

Caleb Foust 45 Jun 13, 2022
To simplify the development of ESP32 in ESP-IDF, Easyio provides a complete driver library

Easyio 开源驱动库 Easyio 是一款适配于ESP-IDF框架的开源驱动库,以支持ESP32的简便开发。目的是简化乐鑫ESP-IDF开发框架的使用难度。(真要方便的话,有现成的Arduino和Platform可以用,不过实在迫于工作要求,有的开源东西不让用,同时便于对接FAE,于是就有了 E

null 161 Jun 21, 2022
Implements a complete GNU/Linux program

Linux-app Implements a complete GNU/Linux program The example program is part of a system for monitoring a running GNU/Linux system. It includes these

Spoorthi Naik 1 Jun 19, 2022
HESS (Hyper Exponential Space Sorting) is a polynomial black-box optimization algorithm, that work very well with any NP-Complete, or NP-Hard problem

The original HESS (Hyper Exponential Space Sorting) is a polynomial black-box optimization algorithm, that work very well with any NP-Complete, or NP-Hard problem, at 2021 thanks to suggestions of Daniel Mattes, work like a complete algorithm.

SAT-X 3 Jan 18, 2022
HESS HAMILTONIAN PATH COMPLETE (2021) black-box for Hamiltonian Path Problem

The original HESS (Hyper Exponential Space Sorting) is a polynomial black-box optimization algorithm, that work very well with any NP-Complete, or NP-Hard problem

SAT-X 1 Jan 19, 2022
Programming tutorial series for creating LV2 plugins using C/C++ and turtle.

Programming LV2 Plugins From Scratch Programming tutorial series for creating LV2 plugins using C/C++ and turtle. Content Programming LV2 Plugins From

null 29 Jun 21, 2022
Implementation and tutorial for a dynamic vector data-structure in C.

Vec: A Dynamic Vector in C The subject.md file contains exercises for this implementation if you want to do it yourself. In that case, don't peek at t

Julius Koskela 28 Jun 25, 2022
Tutorial to connect the Waveshare display ST7789V to the ESP32

ESP32-ST7789V This repository contains the required configuration to connect a display Waveshare ST7789V to an ESP32 board. The correct connection to

Pedro Paulo Amorim 1 Nov 14, 2021