Git Product home page Git Product logo

compilers's Introduction

Compilers

My open course on Compilers, Grammars and Programming Languages

This repository contains the code I wrote for my self-inflicted class about Compilers https://pgrandinetti.github.io/compilers/.

Use it at your risks.

About the project

As side project for a MOOC on Compilers I built a new (basic) programming language. Turing-complete, but without supports for many things.

This repo contains the Grammar's specifications, as well as the compiler for this new language, written in C and organized in 4 modules:

  • Lexical Analysis
  • Parsing
  • Semantic Analysis
  • Code Generation

Compile!

  1. Compile my Compiler! You'll need a C compiler, e.g. gcc main.c cgen.c parser.c lexer.c
  2. Write your program in my language and place it in a text file. An example is offered in the repo with the file code.e.
  3. Now compile your program with ./a.out ./code.e.

The result is a Python executable script, by default ./out.py. You can optionally run ./a.out ./code.e /home/user/result.py, to specify the path for the output file.

Question?

  • Why generated code is in Python?
  • What is my language?
  • How does the Compiler work?

Answers: https://pgrandinetti.github.io/compilers/

compilers's People

Contributors

pgrandinetti avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.