Skip to content

AshwathVS/mc-jacc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 

Repository files navigation

mc-jacc

Just another compiler with weird syntax (extension .mc). It is still in front end stage.

Things to do:

1. Intermediate Code Generation
2. Backend code generation

Variable Declaration

Variable declaration must be done inside '<' and '>'. If you want to assign a value, you can put the value inside brackets.

<int i(100)>

Function Declaration

Function declaration must be done within double < and > operators.
Function call can be done with '$.' followed by function name.

<<int add(<int a>, <int b>)>> {
  <int c(a+b)>
  return c
}

Start Function

'initiate' is the start function which will not accept any arguments.

<<int initiate()>> {
    ...
}

Decision and looping statements

All these statements needs to be called with '@.' prefix.
If:

<int c>
@.IF(10 < 100) {
  c = $.add(100, 200)
} @.ELSE_IF() {
  c = $.add(200, 100)
} @.ELSE {
  c = -1
}

For:

@.FOR(<int c(100)>; c < 200; c=c+1) {
    ...
}

Do while:

@.DO_WHILE(c < 1000) {
    ...
}

While:

@.WHILE(c < 2000) {
    ...
}

About

Compiler design using Java

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published