Battle Turing's List of Tokens and Operators

Tags:

#battle turing #custom programming language #grammar #compiling

By: Aaron Jencks

Views: 478
Posted on:

March 17, 2023, 1:47 a.m.

0 👍 0 👎

I need to begin creating my compiler from scratch, because I just realized that the way I'm doing things right now isn't going to work at all. So my plan here is to solidify the list of tokens that are accepted by the lexer:

Token Code
! 33
& 38
' 39
( 40
) 41
: 58
; 59
< 60
> 62
^ 94
{ 123
| 124
} 125
if 303
else 304
while 305
read 306
write 307
goto 308
left 309
right 310
!= 311
<< 312
>> 313
<= 314
>= 315
true 316
false 317
halt 318
break 319
continue 320
start 321
accept 322
reject 323

In addition to these there are a few tokens that will use regular expressions:

Token expression code
Literal '.' 300
Comment #.*\n -1
Integer [1-9]\d+ 301
Identifier [^0-9][_a-zA-Z]+[_a-zA-Z0-9]* 302

Luckily for me, since I'm using prefix notation, I don't actually need to have any operator precedence or associativity, that much is left up to the user.

Next Steps

I already have a lexer, my next step is to begin working on the grammar for the language, as well as parsing. I had already implemented this before, but I'm not happy with the way that everything is working, so I'm going to scrap it and try again.

Comments

You are not logged in, please log in here to comment

Current Comments