Search results
People also ask
What is lobster programming language?
Is lobster a general purpose language?
Is lobster open source?
What is lobster type check?
What syntax does lobster use?
How do lobster functions differ from other languages?
Lobster is a programming language that tries to combine the advantages of static typing and compile-time memory management with a very lightweight, friendly and terse syntax, by doing most of the heavy lifting for you.
Lobster is a statically typed programming language with a Python-esque syntax that combines the advantages of an expressive type system and compile-time memory management with a very lightweight, friendly and terse syntax, by doing most of the heavy lifting for you.
Apr 2, 2023 · A concise walkthrough of Lobster, a programming language that has a Python-like syntax but is statically typed with next-level inference and does not rely on a garbage collector.
- 21 min
- 150.7K
- Code to the Moon
- Lexical Definition
- Grammar
- Types
- User Defined Types
- Operators
- Function Definitions
- Typing
- Enums
- Programs Structure
- Memory Management
Whitespace is space, tab, carriage return, nested commentsdelimited by /* and */ or single line commentsstarting with //Operator tokens are( ) [ ] { } : , & | + ++ += - -- -= * *= / /= % %= == != < > <= >= <- = ? . -> ^ << >>Strings delimited by " and character constants with' using escape codes \n \t \r \' \ \x(followed by 2 hex digits, e.g. \xFF is the character withvalue 255). Alternatively, strings can be enclos...Numbers consisting of a series of digits to indicate an integerconstant (e.g. 123) or hex digits with a leading0x (e.g. 0xABADCAFE) or digits with a single. (e.g. .1 or 1. or1.1) to indicate a floa...Below, ... indicates a loop with exit point at thatscope level (ex. (ident ... ,) ->(ident (, ident)*), * meaning optionaly repeating), and|| is like | except indicates a precedencelevel difference. [rule]Means optional. program = stats end_of_file stats = topexp … linefeed topexp = namespace ident |import [from ] ( string_constant | ( ident … . ) ...
Lobster is statically typed, and any variable, argument or vectorelement can be a value of one of the following types: 1. Scalar types (64-bit on all platforms): 1.1. int : a signed integer. Constructed using: 1.1.1. integer constants : 123 1.1.2. hexadecimal constants : 0xABADCAFE 1.1.3. character constants : 'A'(65) 1.1.4. default boolean values ...
The class and structkeywords allow you todefine a user defined type. For example: You can use either class or structtodefine these, with the latter being more restrictive: they are storedin-inline in their parent and copied. This makes sense for small objectssuch as the one in this example. You specify a list of fields using indentation. Optionally...
Lobster comes with a set of built-in operators mostly familiar fromother languages that attempt to work on as many of the above types asmakes sense. In particular, unlike most languages, many of them work on(numeric) structs, which makes typical game code both convenient andfast.
Lobster’s entire design centers around functions and how they can becomposed. It has both named functions and functionvalues.
Lobster is statically typed, though most of the time you don’tnotice, since most types can be inferred. You specify types: 1. To define overloaded / dynamic dispatched functions (seeearlier). 2. To provide coercion (int -> float,anything -> string) 3. As documentation. 4. To get simpler/earlier type errors. As we’ve seen, you can type function argu...
An enum defines a “strongly typed alias” for theint type. What this means is that these values are fullycompatible with int in any use, but a regularintcan’t be passed to a context where an enum type isexplicitly requested. You can convert integers explicitly to an enum with a coercionfunction, e.g. example(1) will create a value equivalent intype ...
A lobster program is like the body of a function: a list ofexpressions on separate lines, defined by a single file, the main fileof your program. At this top level of a file, you can additionally usethe importkeyword to bring additional code into yourprogram: The contents of that file will be merged into your main file at thelocation of the importf...
Lobster uses (compile time) reference counting as its form ofmanagement for many reasons. Besides simplicity and space efficiency,reference counting makes a language more predictable in how much time isspent for a given amount of code, since memory management cost is spreadequally through all code, instead of causing possibly long pauses likewith g...
Lobster is a statically typed programming language with a Python-esque syntax that combines the advantages of an expressive type system and compile-time memory management with a very lightweight, friendly and terse syntax, by doing most of the heavy lifting for you.
Lobster is a statically typed programming language with a Python-esque\nsyntax that combines the advantages of an expressive type system and\ncompile-time memory management with a very lightweight, friendly and\nterse syntax, by doing most of the heavy lifting for you.
Conversation/Podcast Playlist: https://www.youtube.com/playlist?list=PLvv0ScY6vfd_Hk1jw-NIDSOK-RhMOhEg3 Find full courses on: https://courses.mshah.io/ Join...
- 124 min
- 1809
- Mike Shah