Skip to content

My own lexer implementation called "Simplexer"

Notifications You must be signed in to change notification settings

artenni4/Simplexer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Work example

For the time I did not update readme file output could change. However now test.txt is:

// this function adds to numbers
function add(a, b) {
	return a + b;
}

print("adfb"); // print some text
a = 56;
b = a - 20;
res = add(a, b);

and output is:

File test.txt was successfuly read
Line: (1,1)     Type: COMMENT       Symbol:  this function adds to numbers
Line: (2,1)     Type: SYMBOL        Symbol: function
Line: (2,10)    Type: SYMBOL        Symbol: add
Line: (2,13)    Type: LEFT_PARAN    Symbol:
Line: (2,14)    Type: SYMBOL        Symbol: a
Line: (2,15)    Type: COMMA         Symbol:
Line: (2,17)    Type: SYMBOL        Symbol: b
Line: (2,18)    Type: RIGHT_PARAN   Symbol:
Line: (2,20)    Type: LEFT_CURLY    Symbol:
Line: (3,2)     Type: SYMBOL        Symbol: return
Line: (3,9)     Type: SYMBOL        Symbol: a
Line: (3,11)    Type: PLUS          Symbol:
Line: (3,13)    Type: SYMBOL        Symbol: b
Line: (3,14)    Type: SEMICOLON     Symbol:
Line: (4,1)     Type: RIGHT_CURLY   Symbol:
Line: (6,1)     Type: SYMBOL        Symbol: print
Line: (6,6)     Type: LEFT_PARAN    Symbol:
Line: (6,7)     Type: STRING        Symbol: adfb
Line: (6,13)    Type: RIGHT_PARAN   Symbol:
Line: (6,14)    Type: SEMICOLON     Symbol:
Line: (6,16)    Type: COMMENT       Symbol:  print some text
Line: (7,1)     Type: SYMBOL        Symbol: a
Line: (7,3)     Type: EQUAL         Symbol:
Line: (7,5)     Type: INTEGER       Symbol: 56
Line: (7,7)     Type: SEMICOLON     Symbol:
Line: (8,1)     Type: SYMBOL        Symbol: b
Line: (8,3)     Type: EQUAL         Symbol:
Line: (8,5)     Type: SYMBOL        Symbol: a
Line: (8,7)     Type: MINUS         Symbol:
Line: (8,9)     Type: INTEGER       Symbol: 20
Line: (8,11)    Type: SEMICOLON     Symbol:
Line: (9,1)     Type: SYMBOL        Symbol: res
Line: (9,5)     Type: EQUAL         Symbol:
Line: (9,7)     Type: SYMBOL        Symbol: add
Line: (9,10)    Type: LEFT_PARAN    Symbol:
Line: (9,11)    Type: SYMBOL        Symbol: a
Line: (9,12)    Type: COMMA         Symbol:
Line: (9,14)    Type: SYMBOL        Symbol: b
Line: (9,15)    Type: RIGHT_PARAN   Symbol:
Line: (9,16)    Type: SEMICOLON     Symbol:

About

My own lexer implementation called "Simplexer"

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published