Giter VIP home page Giter VIP logo

era_compiler's Introduction

ERA COMPILER

example workflow

This is system-level programming language compiler for processors with ERA architecture.

Basic architecture

The most abstract architecture of the compiler:

File with code -> Lexical Analyzer ->
-> Tokens -> Syntax Analyzer ->
-> Abstract Syntax Tree -> Semantic Analyzer ->
-> Annotated AST -> Generator ->
-> File with compiled code

Compiler usage

Compiler works as console appilcation.
The main command is ERACompiler.
There are several arguments available:

  • -h : see help
  • -s {filename} : specify source files to be compiled
  • -o {filename} : specify output files
  • -d {paths} : specify folders with the code to be compiled (cannot be used with -o parameter)
  • -p : force to create folders if they do not exist
  • --err : display more detailed error messages
  • --lex : perform tokenization only
  • --syn : perform tokenization and AST assembling
  • --sem : perform tokenization, AST assembling, and AAST assembling
  • --semext : same as --sem with more detailed output
  • --asm : full compilation with the assembly code output
  • --prefix : custom filename prefix for output files
  • --ignconf : ignore configuration file and rely only upon command-line flags

Examples of commands:
ERACompiler -h - get help message
ERACompiler -s test.txt folder1/file1.java - will compile source files to compiled_test.txt and folder1/compiled_file1.java
ERACompiler --lex -o out.a - will compile default code.era file to the out.a using only tokenization

ERA Simulator

Here is the link to the ERA Simulator GitHub repo:
https://github.com/egorklementev/era_simulator

It is aslo a Windows x64 command-line application with similar arguments and way of usage.

Vim syntax highlight

Since no one want to program in the "notepad.exe" (why not?), there is a special era.vim file that adds a support of ERA language syntax highlighting. You may find it in the ../DOCS folder. How to use Vim and its syntax highlighting, you may find in Google.

The support for VS/VSCode, Intellij IDEA, and etc. will be added later.

ATTENTION:

It is highly recommended to read example.era file which gives basic understanding of the ERA language.
example.era

Also, read documentation files in ../DOCS folder for more information about ERA language.

era_compiler's People

Contributors

egorklementev avatar

Watchers

 avatar

era_compiler's Issues

Implement SSA

REASON: We need it to simplify code optimizations and register allocation.

  • Identify all the versions of variables
  • Numerate all the statements
  • When IF block occurs (without "else"), identify all variables reassigned inside it and compute FI function based on this information
  • When IF block occurs (with "else"), act as previously plus identify all the variables that are used in both blocks
  • When FOR, WHILE, or LOOP WHILE blocks occur, act as in IF block case (without "else")

'pragma' rule

Change

  • 'pragma' PragmaDeclaration ;

to

  • 'pagma' PragmaDeclaration { PragmaDeclaration } 'end'

Reference is not constant now

REASON: It can be constant theoretically. However, for now, the decision is that a reference should not be used in constant expressions.

[34] Add LDA command to the asm block.

REASON: Eventually, we understood that LDA commands are present in the simulator, so the corresponding command should be added in the language itself.

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.