Category:Objeck: Difference between revisions
No edit summary |
mNo edit summary |
||
(117 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
{{language|Objeck |
|||
|exec=bytecode |
|||
|site=http://www.objeck.org |
|||
|gc=yes |
|||
|parampass=value |
|||
|safety=safe |
|||
|checking=static |
|||
|strength=strong |
|||
|LCT=yes}} |
|||
{{language programming paradigm|Object-oriented}}{{language programming paradigm|functional}} |
|||
'''Objeck ''' is an [[object-oriented]] computing language with [[functional programming|functional]] features. The language was based upon the author's use of [[Java]] and [[Scheme]]. In the language, all data types are treated as objects and first-class functions that support closures. |
|||
The Objeck computer language is an object-oriented (OO) computing language that has ties with Java, Pascal and indirectly Ruby. In this language, all data types are treated as objects. This language contains all of the "basic" features of a general-purpose (Turing complete) programming language with an emphasis placed on OOP simplicity. The language consists of a compiler and virtual machine with associated garbage collector and JIT compiler. The compiler emits binary byte code that is executed by the runtime system. The runtime system has the ability to translate the byte code into IA-32 or AMD64 native machine code. The engineering goal is to have basic optimizations (peep hole) performed by the source code compiler and advanced optimizations performed by the JIT compiler. |
|||
The programming environment consists of an optimizing compiler, command-line debugger, and virtual machine with associated [[Garbage collection|garbage collector]] and [[JIT]] compiler. The compiler emits binary [[bytecode]] that is executed by the runtime system. The 64-bit runtime JIT compilers support ARM64 and AMD64 machine code targets for macOS, Linux and Windows. |
|||
Feel free to check out the [http://objeck-lang.svn.sourceforge.net/viewvc/objeck-lang/objeck-lang/docs/objeck_lang.pdf Introduction to Objeck] PDF document. |
|||
Learn more from the [https://www.objeck.org/getting_started.html getting started guide]. |
|||
==Examples== |
|||
===Hello World!=== |
|||
<lang objeck> |
|||
bundle Default { |
|||
class SayHello { |
|||
function : Main(args : String[]), Nil { |
|||
"Hello World!"->PrintLine(); |
|||
} |
|||
} |
|||
} |
|||
</lang> |
|||
===Prime Numbers=== |
|||
<lang objeck> |
|||
bundle Default { |
|||
class FindPrime { |
|||
function : Main(args : System.String[]), Nil { |
|||
Run(1000000); |
|||
} |
|||
function : native : Run(topCandidate : Int), Nil { |
|||
candidate : Int := 2; |
|||
while(candidate <= topCandidate) { |
|||
trialDivisor : Int := 2; |
|||
prime : Int := 1; |
|||
found : Bool := true; |
|||
while(trialDivisor * trialDivisor <= candidate & found) { |
|||
if(candidate % trialDivisor = 0) { |
|||
prime := 0; |
|||
found := false; |
|||
} |
|||
else { |
|||
trialDivisor := trialDivisor + 1; |
|||
}; |
|||
}; |
|||
if(found) { |
|||
candidate->PrintLine(); |
|||
}; |
|||
candidate := candidate + 1; |
|||
}; |
|||
} |
|||
} |
|||
} |
|||
</lang> |
|||
===Socket Client=== |
|||
<lang objeck> |
|||
use Net; |
|||
use IO; |
|||
bundle Default { |
|||
class SocketTest { |
|||
function : Main(args : System.String[]), Nil { |
|||
address := "www.du.edu"; |
|||
socket := TCPSocket->New(address, 80); |
|||
if(socket->IsOpen()) { |
|||
get := "GET / HTTP/1.1\r\nHost: "; |
|||
get->Append(address); |
|||
get->Append("\r\n\r\n"); |
|||
socket->WriteString(get); |
|||
line := socket->ReadString(); |
|||
while(line->GetSize() > 0) { |
|||
trim := line->Trim(); |
|||
start : Int; |
|||
end : Int; |
|||
for(i := 0; i < trim->GetSize(); i := i + 1;) { |
|||
# find tag start |
|||
if(trim->GetChar(i) = '<') { |
|||
start := i; |
|||
}; |
|||
# find tag end |
|||
if(trim->GetChar(i) = '>') { |
|||
end := i; |
|||
len := i - start; |
|||
# print tag |
|||
if(len > 0) { |
|||
tag := trim->SubString(start + 1, len - 1); |
|||
if(tag->GetSize() > 0) { |
|||
if(tag->GetChar(0) <> '/') { |
|||
tag_end := 0; |
|||
while(tag_end < tag->GetSize() & |
|||
tag->GetChar(tag_end) <> ' ') { |
|||
tag_end := tag_end + 1; |
|||
}; |
|||
Console->GetInstance()->Print("start tag: |")->Print(tag->SubString(tag_end))->PrintLine("|"); |
|||
} |
|||
else { |
|||
tag_end := 1; |
|||
while(tag_end < tag->GetSize() & |
|||
tag->GetChar(tag_end) <> ' ') { |
|||
tag_end := tag_end + 1; |
|||
}; |
|||
Console->GetInstance()->Print("end tag: |")->Print(tag->SubString(1, tag_end - 1))->PrintLine("|"); |
|||
}; |
|||
}; |
|||
}; |
|||
}; |
|||
}; |
|||
line := socket->ReadString(); |
|||
}; |
|||
socket->Close(); |
|||
} |
|||
else { |
|||
error := "unable to connect to: "; |
|||
error->Append(address); |
|||
error->PrintLine(); |
|||
}; |
|||
} |
|||
} |
|||
} |
|||
</lang> |
Latest revision as of 16:11, 13 June 2023
This programming language may be used to instruct a computer to perform a task.
Official website |
---|
Execution method: | Compiled (bytecode) |
---|---|
Garbage collected: | Yes |
Parameter passing methods: | By value |
Type safety: | Safe |
Type strength: | Strong |
Type checking: | Static |
See Also: |
Objeck is an object-oriented computing language with functional features. The language was based upon the author's use of Java and Scheme. In the language, all data types are treated as objects and first-class functions that support closures.
The programming environment consists of an optimizing compiler, command-line debugger, and virtual machine with associated garbage collector and JIT compiler. The compiler emits binary bytecode that is executed by the runtime system. The 64-bit runtime JIT compilers support ARM64 and AMD64 machine code targets for macOS, Linux and Windows.
Learn more from the getting started guide.
Subcategories
This category has the following 3 subcategories, out of 3 total.
@
- Objeck examples needing attention (empty)
- Objeck Implementations (empty)
- Objeck User (1 P)
Pages in category "Objeck"
The following 200 pages are in this category, out of 331 total.
(previous page) (next page)A
- A+B
- Abbreviations, automatic
- ABC problem
- Abstract type
- Accumulator factory
- Ackermann function
- AKS test for primes
- Almost prime
- Anagrams
- Angle difference between two bearings
- Anti-primes
- Apply a callback to an array
- Apply a digital filter (direct form II transposed)
- Arithmetic-geometric mean
- Arithmetic/Integer
- Array concatenation
- Array length
- Arrays
- Assertions
- Associative array/Creation
- Associative array/Iteration
- Attractive numbers
- Averages/Arithmetic mean
- Averages/Median
- Averages/Mode
- Averages/Pythagorean means
- Averages/Root mean square
- Averages/Simple moving average
- AVL tree
B
C
- Caesar cipher
- Call an object method
- Cantor set
- Case-sensitivity of identifiers
- Casting out nines
- Catamorphism
- Chaocipher
- Character codes
- Chat server
- Check that file exists
- Cholesky decomposition
- Classes
- Closures/Value capture
- Collections
- Comma quibbling
- Command-line arguments
- Comments
- Compile-time calculation
- Compound data type
- Concurrent computing
- Conditional structures
- Constrained genericity
- Copy a string
- Count in factors
- CRC-32
- Create a file
- Create a two-dimensional array at runtime
- Create an HTML table
- CSV data manipulation
- CSV to HTML translation
- Cumulative standard deviation
- CUSIP
D
- Damm algorithm
- Date format
- Deal cards for FreeCell
- Delegates
- Delete a file
- Department numbers
- Determine if a string is numeric
- DNS query
- Documentation
- Dot product
- Doubly-linked list/Definition
- Doubly-linked list/Element definition
- Doubly-linked list/Element insertion
- Doubly-linked list/Traversal
- Draw a pixel
- Draw a rotating cube
- Draw pixel 2
E
F
- Factorial
- Factors of an integer
- FASTA format
- Fibonacci sequence
- Fibonacci word
- File extension is in extensions list
- File input/output
- File modification time
- File size
- Filter
- Find duplicate files
- Find URI in text
- First-class functions
- First-class functions/Use numbers analogously
- FizzBuzz
- Forward difference
- Function composition
- Function definition
G
H
- Happy numbers
- Harshad or Niven series
- Hash from two arrays
- Haversine formula
- Hello world/Graphical
- Hello world/Newline omission
- Hello world/Text
- Hello world/Web server
- Higher-order functions
- Hofstadter-Conway $10,000 sequence
- Horizontal sundial calculations
- Horner's rule for polynomial evaluation
- Hostname
- HTTP
- HTTPS
I
L
- Leap year
- Least common multiple
- Letter frequency
- Levenshtein distance
- Literals/Floating point
- Literals/Integer
- Literals/String
- Logical operations
- Loop over multiple arrays simultaneously
- Loops/Break
- Loops/Continue
- Loops/Do-while
- Loops/Downward for
- Loops/For
- Loops/For with a specified step
- Loops/Foreach
- Loops/Infinite
- Loops/N plus one half
- Loops/While
- Ludic numbers
- Luhn test of credit card numbers
- LZW compression