Skip to content
/ L Public

A postfix-oriented programming language built using Racket

License

Notifications You must be signed in to change notification settings

ZiyadBoshima/L

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

L

L is a postfix-oriented programming language that offers basic operations, such as arithmetic operations and logical operations, and other extra operations, like “tell me a joke”. The language uses some constructs similar to assembly languages. There are also other unique constructs.

Authors

Usage

Setup

To get started clone this repo:

git clone https://github.com/ZiyadBoshima/L.git

Ensure you have the racket command line tool installed.

In order for L code to run, it should be written inside code.el.

./
 L.rkt
 code.el
 LICENSE
 README.md

To run L code, run the following command in the terminal:

racket L.rkt

To code in L, begin your code with “start:” and end it with “end start”. The body of the program will be between two curly braces, like so:

start:
{
  program_body
}
end start

Variable Definition

To define a variable, use [mov] operator like so:

Variable  Value  [mov]

or

Variable  Variable  [mov]

The variable type does not need to be declared as L is dynamically type. The possible types of values are: integers, floats, strings.

Operations

For arithmetic, logical, and relational expressions, the operators are defined as follows: [and], [or], [not], [add], [sub], [mul], [div], [mod], < as [s], > as [b], <= as [se], >= as [be]. These can be used in this syntax:

Variable Variable [operator]

or

Value Value [operator]

Print

In order to print results in the console, L provides the show{} function, and can be used like so:

show{Something}

Spaces and new lines can be added to the output by using . and .n respectively. In order to be used with operations and values, a separator symbole | must be used.

show{. | String} // adds space to a single space
show{String | .n} // adds new line after string

The order of the objects inside the can be in any order, and can be repeated as many times.

show{ space_or_newline | value_or_variable_or_operation}

Cast

L provides a casting function, convert(), that turns an integer into a string.

convert(variable_or_value)

Tell me a joke

If at times programming feels mundane—hopefully never with the L language—run this function:

[tell me a joke]

Example

./code.el

start: 

show{'1 + 2 is '| 1 2 [add] | .n | .n} 

[tell me a joke] 

end start

output:

1 + 2 is 3

How did the hipster burn the roof of his mouth?
He ate the pizza before it was cool.

About

A postfix-oriented programming language built using Racket

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published