diff options
author | Kyle Gunger <corechg@gmail.com> | 2020-07-03 13:17:26 -0400 |
---|---|---|
committer | Kyle Gunger <corechg@gmail.com> | 2020-07-03 13:17:26 -0400 |
commit | 5a022193a96e72fa5144755938e6a575aba165b0 (patch) | |
tree | b04404711ee7aa232b116bb40fac10fd12637978 /examp.tnsl | |
parent | 135c347a1d9ee7f121fea275139bce85fae33e0c (diff) |
Extra Numbers
+ Add line and character numbers to tokens
+ Impliment line and character numbers
~ Line and char nums start at 0 for now
~ There's this itch in my mind like something is broken
Diffstat (limited to 'examp.tnsl')
-rw-r--r-- | examp.tnsl | 45 |
1 files changed, 23 insertions, 22 deletions
@@ -1,26 +1,25 @@ #Comment like this -/# +/## Or like this (blocks begin with /<symbol> and end with <symbol>/) + Block Comment +#/ +/## + Doc Comment #/ - - - # Preprocessor directives are like this # Import from library using ' -:import 'what/what.tnsl' +:import 'what/what.tnsl' a # Import from local file using " :import "what/what.tnsl" - - # Code lines start with ; # pass a variable ;int s = 3 - +;byte bitbyte = .2 # generic scope block @@ -38,8 +37,6 @@ # d does not exist - - # Function def: # Any non-reserved word # Sig: [output1, output2] (input1, input2) @@ -53,13 +50,13 @@ # ~ after a address var represents the data the address points at ;int i = 1 - ;~int j = ~i # address of int j = address of i + ;~int j ~= i # address of int j = address of i j~ = 2 # i = 2 # data of j = 2 # /;loop represents the only loop in tnsl # loop is followed by (init statements) [multi statements] # where the first statement in multi is the test, and the once statements are only run once at the beginning of the loop - /; loop [i!==1] + /;loop [i!==1] # Do something ; i = 1 ;/ @@ -145,7 +142,10 @@ # You can do stuff here too /; if [t == 2] - i = t - i + ;i = t - i + + ;;else if [t==3] + ;i = t+i ;/ # Second case block @@ -155,17 +155,18 @@ ;/ -/;(type T) # Generic type - ; struct [gen] { - T i - } -;/ +# Dumb generic type struct +; struct [gen] (type T) { + T i +} +# This seems dumb ;gen(int) j{2} -;{}gen(int) j{ - {1}, - {2}, - {3} +# But this seems dumber +;{}gen(gen(int)) j{ + {{1}}, + {{2}}, + {{3}} } |