This repository has been archived by the owner on Apr 29, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
331 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<p align="center"> | ||
<h1 align="center">armv4t_asm</h1> | ||
<p align="center"> | ||
Assembler for the ARMv4T CPU Architecture. | ||
</p> | ||
</p> | ||
|
||
_Recommended reading: ["An Introduction to the GNU Assembler"][intro]._ | ||
|
||
[intro]: doc/gnu_assembler.pdf | ||
|
||
## Installation | ||
|
||
This package can be used as a standalone executable, or as a dependency. | ||
|
||
### CLI | ||
|
||
Use [`pub global activate`](https://www.dartlang.org/tools/pub/cmd/pub-global) | ||
to install the assembler as a local program to be used on the command-line: | ||
|
||
```bash | ||
$ pub global activate armv4t_asm | ||
$ armv4t_asm filename.s | ||
> Assembling filename.s as filename.o... | ||
> Wrote filename.o in 10ms. | ||
``` | ||
|
||
Use `armv4t_asm --help` to get full usage information. | ||
|
||
### Pub | ||
|
||
```yaml | ||
dependencies: | ||
armv4t_asm: | ||
``` | ||
|
||
## Usage | ||
|
||
TBD. |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +0,0 @@ | ||
|
||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import 'package:func/func.dart'; | ||
import 'package:math_expressions/math_expressions.dart'; | ||
|
||
/// Returns the result of evaluating a mathematical [expression]. | ||
dynamic eval(String expression, int lookup(String varName)) => new Parser() | ||
.parse(expression) | ||
.evaluate(EvaluationType.REAL, new _DynamicContext(lookup)); | ||
|
||
class _DynamicContext extends ContextModel { | ||
final Func1<String, int> _lookup; | ||
|
||
_DynamicContext(this._lookup); | ||
|
||
@override | ||
Expression getExpression(String varName) { | ||
final result = _lookup(varName); | ||
if (result != null) { | ||
return new Parser().parse('$result'); | ||
} | ||
return super.getExpression(varName); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.