- Add function declarations, calls, and return statements - Implement lexical scoping with Environment class and closures - Convert print from statement to standard library function - Add assert() function to standard library for testing - Add time() function for microsecond precision benchmarking - Create StdLib class and BuiltinFunction wrapper for standard library - Implement first-class functions and higher-order functions - Add function parameter support (tested up to 100 parameters) - Support alphanumeric identifiers in variable and function names - Add underscore support in variable names and identifiers - Implement string + number and number + string concatenation - Add boolean + string and string + boolean concatenation - Support string multiplication (string * number) - Fix decimal truncation issue by using std::stod for all number parsing - Add comprehensive number formatting with proper precision handling - Support huge numbers (epoch timestamps) without integer overflow - Clean number display (no trailing zeros on integers) - Add basic error handling with program termination on errors - Add comprehensive test suite covering all features - Add escape sequence support (\n, \t, \", \\) - Add comprehensive documentation and language reference - Update development roadmap with completed features
30 lines
598 B
Python
30 lines
598 B
Python
import time
|
|
|
|
# Test the time function
|
|
print("Testing time function:")
|
|
|
|
time1 = time.time()
|
|
print(f"Time 1: {time1}")
|
|
|
|
time2 = time.time()
|
|
print(f"Time 2: {time2}")
|
|
|
|
time3 = time.time()
|
|
print(f"Time 3: {time3}")
|
|
|
|
diff1 = time2 - time1
|
|
diff2 = time3 - time2
|
|
|
|
print(f"Difference 1-2: {diff1} seconds")
|
|
print(f"Difference 2-3: {diff2} seconds")
|
|
|
|
# Test with some work in between
|
|
start = time.time()
|
|
sum_val = 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10
|
|
end = time.time()
|
|
duration = end - start
|
|
|
|
print(f"Work duration: {duration} seconds")
|
|
print(f"Sum: {sum_val}")
|
|
|
|
print("Time function analysis complete!") |