Inspiration
While teaching my little brother coding I wanted a very simple interpreter that was easy for my brother to understand. This inspired me to attempt to wright my own programming language.
What it does
Jaithon is a Very simple General purpose programming language. It has many functionality such as the following.
- Variable Assignment: You can assign values to variables using the var keyword. Syntax: var x = 5
- Array Declaration: You can init arrays using the array keyword. Syntax: array arr = [1]
- Array Element Modification: You can modify elements of an array using the dot notation. Syntax: arr.add(0, 4).
- Print Statement: You can use the print keyword to print values to the console. Syntax: print x
- Mathematical Expressions: You can perform arithmetic operations (+, -, *, /) on numbers.
- Comparrisions: you can preform comparrisions by using the > and < symbols. Syntax: var a = 1>4 >> the output would be a = 0 because that statement is false.
- Parentheses: You can use parentheses to group expressions and control operator precedence. PEMDAS
- Trigonometric Functions: You can use trigonometric functions such as sin, cos, tan, asin, acos, atan, sqrt. Syntax: sin(3) sin(x)
- Detecting User input: You can detect user input. Syntax: input variable_name
- Time: You can access the users internal Clock by using the time keyword. Syntax: var t = time() This saves the time as an integer.
- Comments: You can add comments using the # symbol. Commented lines are displayed in green.
- If loops: You can do if loops by using the if/do keywords. Syntax: if 1>4 do print 1
How we built it
I wrote this using the C language, and I started with mathematical operations and then expanded to the additional functionalities I have as of right now.
Challenges we ran into
I had challenges while adding boolean functions in my language. To work around this challenge, I substituted True and False statements with 1s and 0s. I also had challenges in adding if clauses, so I implemented the comparisons such as greater than and less than, and this led to the if clauses becoming very easy.
Accomplishments that we're proud of
- If else clause
- Boolian language
- Arrays
- My brother learning how to code
## What we learned I learned about the nitty-gritty of writing an interpreter. Now I am eager to learn and write my own 2 pass compiler in the future.
What's next for Jaithon - The JAI language.
- Implementation of for loop
- Strings
- Simple functions
- Custom functions
- classes
Built With
- c
- interpreter
- parser
Log in or sign up for Devpost to join the conversation.