Cezve
How to compile Project?

This is my main function, you should write ‘node . compile’ and path of source code example ( node . compile test/test.cezve ). As you can see first lexer will start, it will read source code and identify type of input then parser will start and check the grammer is true or not. DoubleClick ‘cezve.bat’ to run tests.
Tokens

I have 15 token type in my programming language. Constants is the base of my identify the token.
Lexer

Lexer class object has 3 properties and 5 methods. Data property for input, currentChar for which char is this now, for position which index are we in. nextToken method for get next token. Start method is will read the all input and identify then, end of the start method, I added to EOF type which means (End Of File).

Make number method first identify the number with our constants, after that we read the input and check the number is float or integer. İf you write ‘345abc’ something like that, lexer will warn you.

Make string method first check has ‘apostrophe’, if has make string method will run and get the all characters in between apostrophes

If lexer read a input begins with character, Make detect method will run and it’ll check the type of characters, is it arithmetic expression, or assign operation or identifier.
Parser

Parser class object get the tokens, which we had value after lexer. Next method for get next token, parse method for begining of my grammer if first token includes (int, float or string) assign method will run else expression will run.


Grammer

STATE DIAGRAM FOR RECOGNIZE TOKENS

Test



project link: github