Search results
- While it is a general purpose language, its current implementation is biased towards games and other graphical things, with plenty of “batteries included” functionality.
www.strlen.com/lobster/
People also ask
What is lobster programming language?
Is lobster a general purpose language?
How do lobster functions differ from other languages?
Is lobster a good OO language?
What is lobster type check?
Is lobster open source?
While I would claim that Lobster is a general purpose programming language, it is strongly biased toward game programming and related fields. With a different set of built-in functions I am sure it would make a kick-ass server language, but I don't feel it is important to serve every niche.
- 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...
Unlike other game making systems that focus on an engine/editor that happens to be able to call out to a scripting language, Lobster is a general purpose stand-alone programming language that comes with a built-in library suitable for making games and other graphical things.
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
{{language|Lobster |site=http://strlen.com/lobster}} '''Lobster''' is a general purpose programming language originally created for programming games. It has a [[Python]]-like syntax, with a static type system that feels like dynamic typing thanks to flow-sensitive type inference and specialization.
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.