Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/polinasavelyeva/simplelanguage
Simple programming language with parser, interpreter and code analyzer
https://github.com/polinasavelyeva/simplelanguage
intrepreter optimizer parser-combinators
Last synced: about 2 months ago
JSON representation
Simple programming language with parser, interpreter and code analyzer
- Host: GitHub
- URL: https://github.com/polinasavelyeva/simplelanguage
- Owner: PolinaSavelyeva
- License: mit
- Created: 2023-11-19T12:00:32.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-12-24T16:43:29.000Z (about 1 year ago)
- Last Synced: 2023-12-24T19:30:21.936Z (about 1 year ago)
- Topics: intrepreter, optimizer, parser-combinators
- Language: F#
- Homepage:
- Size: 94.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
# SimpleLanguage
This repository contains simple programming language with parser, interpreter and code analyzer. The language includes basic constructs such as conditional and print statements, variable assignment and logical expressions.
## Syntax
### Conditional Statement
The syntax for the `if` statement is as follows,
```fsharp
if:then:else:
end
```where
- `` represents a boolean expression which contains operators such as `<`, `&&`, boolean variables [etc](#logical-expressions).
- `` could be one or more statements e.g [print](#print-statement), [variable assignment](#variable-assignment) or other if statements. Make sure there are no tabs between the if-else construction and the statements. Line breaks are also required, as they appeared on the code-syntax block.### Variable Assignment
The syntax for variable assignments is as follows,
```fsharp
=
```where
- `` is the name of the variable. It can only be a sequence of lowercase letters.
- `` one of the available [logical](#logical-expressions) or [arithmetic](#arithmetic-expressions) expressions.### Print Statement
The syntax for the `print` statement is as follows,
```fsharp
print:
```where
- `` one of the available [logical](#logical-expressions) or [arithmetic](#arithmetic_expressions) expressions.### Logical Expressions
Logical expressions can be used in every statement. The supported operators are:
- `==` equal
- `<` less than
- `>` greater than
- `<=` less than or equal
- `>=` greater than or equal
- `!=` inequality
- `&&` logical and
- `||` logical or### Arithmetic Expressions
Arithmetic expressions can be used in every statement. The supported operators are:
- `+` addition
- `*` multiplication## Examples
Here are some examples of code written in this language:
```fsharp
if:true>falsethen:
x=true
print:x