Skip to content

Latest commit

 

History

History
150 lines (108 loc) · 8.12 KB

project.md

File metadata and controls

150 lines (108 loc) · 8.12 KB

Stage 1

create basic required Data structures, define lexer and parser.
Parse RAW and assignment staement , checks for duplicate assignment and valid types for basic types.
Update build system using makefiles

Stage 2

make data structures required for functions and actions(inbuilt funtions, expanding to C functions after compiling)
# test1.c transpiled from test1.ttp for testig of print function(variables only)
Add support for literals and add string literals...
Add print action...and input action
# test2.c transpiled from test2.tpp for testing print and input funtion (variables and literals) Add string declaration.
Add function declaration and scoping
# test3.c transpiled from test3.tpp for testing function declaration and scoping (variables and literals)
test1.ttp test2.ttp do not work from here on as top level statements can only be variable declarations or functionn definations
Added function params varification (for fns declared before as well as later , but no declarations in header yet)
# test4.c transpiled from test4.tpp for testing function param varifications
verifies for return type. if not void shows error if corresponding high level(not inside other constructs like if, for etc) return statement is not found, does not show error for void type.

Stage 3

Add multiple declaration in same line support, compacted normal and assignment declaratin in single rule
Changed representation of complex numbers to (real,img) and added mod keyword for % operation
Add expressions (without fncall) and type varification, but more testing is required.
# test5.c transpiled from test5.tpp for testing expressions without fncall (more testing is required)
use stack to parser nested fncall, revamp the expression and remove unneccessary fns

# test6.c transpiled from test6.tpp for testing expressions with fncall

setup and use Valgrind to check and remove memory leaks;
Commment Document and refactor code
Added typecasting

Stage 4

Added Basic Arrays, array declaration and assignment
Added Using Array values as value
# test7.c transpiled from test7.tpp for testing Basic array assignment, and value access

Add Array support : No nested array
Assignment to arrays at declaration stage
Support String Arrays

Add charbuf to support input-able buffers for string

Support individual character assignment in Strings ? NO , only array of strings.
Added Array Params, Access to Array elements.
The return type does not need array type, as we cannot assign array base once declared, and there is no support for pointers. So only sensible return type that can be array is char *, which is already used as string type.

# test8.c transpiled from test8.tpp for testing array params in functions
Added @decl return to support raw return types
Add Assignment statement
Add comment parsing
# test9.c transpiled from test9.tpp for testing assignment and comments

Stage 5

Added Conditions and if statements : if.. , if..else... , if..else if.. # test10.c transpiled from test10.tpp for testing if..else if.. and nested if

Added while loop
# test11.c transpiled from test11.tpp for testing while loop

Added better condition support : now conditions are expressions as well, which in downside allows expressions to to be used in place of conditions, like C does, but also allows assignment to bool vars directly with conditions , i.e. bool b = a < b .
This was done so that in same amount of conflicts as before, one can use assignments to bool, as well as return statements with conditions etc.
But this still does not allow for multiple assignments (a =b= 6) and assignments instead conditions,so not too bad...? # test12.c transpiled from test12.tpp for testing the updated conditions in expressions

Added for loop
# test13.c transpiled from test13.tpp for testing For loops

make file generating function , generate header file after successful code compiling.
NOTE : all test before now contains some redundant code that uses raw to hardcode fn declarations
Added comment detecting in preparser and prelexer
Added break and continue statements
Added un-supported C tokens error in lexer
Added #line in the generated codefile, for every line, nNOTE that for a generated code structure, like loops, this may show incorrect/slightly off line numbers
# test14.c transpiled from test14.tpp for testing file generation and header generation
Added let syntax for declaring variables whose type can be concretely inferred from their expression., Note that for string type the type will always be char *, if one needs input-able string, one must explicitly use charbuf[]
# test15.c transpiled from test15.tpp for testing let syntax

Stage 6

In case of classes definitions must be defined before use, i.e classes must be defined before other code, and class methods must be defined before they are called.Also all attributes before methods.

added initial class support
Can define attributes , creates new .h and .c files
# test16.c transpiled from test16.tpp for testing class definitions only with attributes
Now after class definition , it adds a #include for each class in the main file

# test17.c transpiled from test17.tpp for testing method declarations
Added method declaration printing in class header files, also added extern declaration in main file header for non-static global variables # test18.c transpiled from test18.tpp for testing multiple class declaration and file generations

Added assignment to class attrs, by separating varvals, which denote values which can be assigned to
Added let assignment for class type

Added verification of class type and check for class in all var access, in expr
Added class support in exprs
let statements for class type assignments

# test19.c transpiled from test19.tpp for testing multiple class declaration , method declarations, class variable declarations, class variable assignment, class variable declarations in let syntax, class variable declaration in decl syntax

Stage 7

Added support for classes in for statements
Added support for classes in params
# test20.c transpiled from test20.tpp for testing class type function params

Added support for classes in fn and method return types
test for making sure expr combing works as expected on class types and other types
# test21.c transpiled from test21.tpp for testing class type function return type and expr type verification

Added support for accessing static and non-static methods
# test22.c transpiled from test22.tpp for testing method access

Added support for creating new class(struct), including those involving const elements , testing is remaining

# test23.c transpiled from test23.tpp for testing creating new classes

Added support fot 'this'
# test24.c transpiled from test24.tpp for testing field and method access using 'this'

Added support for making fields and methods private for classes
# test25.c transpiled from test25.tpp for testing private fields and methods

gives error if tried to pass int in place of float arg...Changed to allow

Added use syntax along with something like pragma once?
Added file of decl in all fn methods classes
# test28.c transpiled from test26.tpp,test27.ttp and test28.ttp for testing use syntax

Cleared up TODOs' , and added a function to remove created files according to a switch variable if number of errors cross limit
Added fn to remove files if any error has occurred according to switch

Added check for void type in fn return

Added actual options for output file, line numbering, file delete, in short form using getopt

Changed action input and print to accommodate classes and array by showing error message if found in args

Added hello world, hashmap and complex examples

add readme, syntax