Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jrudolph/bytecode
Mnemonics - Bytecode generation for scala
https://github.com/jrudolph/bytecode
Last synced: 25 days ago
JSON representation
Mnemonics - Bytecode generation for scala
- Host: GitHub
- URL: https://github.com/jrudolph/bytecode
- Owner: jrudolph
- License: bsd-2-clause
- Created: 2008-08-15T08:03:26.000Z (about 16 years ago)
- Default Branch: master
- Last Pushed: 2013-01-31T11:26:03.000Z (almost 12 years ago)
- Last Synced: 2023-04-11T05:18:13.180Z (over 1 year ago)
- Language: Scala
- Homepage:
- Size: 12.2 MB
- Stars: 21
- Watchers: 6
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Mnemonics - A runtime bytecode generation DSL for Scala
For more info see [Mnemonics: Type-safe Bytecode Generation at Run Time](https://github.com/jrudolph/bytecode/raw/docs/mnemonics.pdf).
There are more papers in the [docs branch](https://github.com/jrudolph/bytecode/tree/docs).
## Example
Here's an example which generates the `+ 1` function:
```scala
scala> import java.lang.Integer
import java.lang.Integerscala> val f = ASM[Integer, Integer](param =>
| _ ~
| param.load ~
| method((x: Integer) => x.intValue) ~
| bipush(1) ~
| iadd ~
| method((x: Int) => Integer.valueOf(x)))
f: java.lang.Integer => java.lang.Integer =scala> f(12)
res0: java.lang.Integer = 13
```