From 5a022193a96e72fa5144755938e6a575aba165b0 Mon Sep 17 00:00:00 2001 From: Kyle Gunger Date: Fri, 3 Jul 2020 13:17:26 -0400 Subject: 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 --- examp.tnsl | 45 +++++++++++++++++++++++---------------------- 1 file changed, 23 insertions(+), 22 deletions(-) (limited to 'examp.tnsl') diff --git a/examp.tnsl b/examp.tnsl index 8d5e257..0c32f3f 100644 --- a/examp.tnsl +++ b/examp.tnsl @@ -1,26 +1,25 @@ #Comment like this -/# +/## Or like this (blocks begin with / and end with /) + 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}} } -- cgit v1.2.3