Skip to content

[PoC] Parse integer data #32

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,6 @@
"dependencies": {
"bitcode": "^1.2.0",
"debug": "^3.2.6",
"llparse-frontend": "^1.2.1"
"llparse-frontend": "git+https://github.com/arthurschreiber/llparse-frontend.git#arthur/binary-parsing"
}
}
2 changes: 2 additions & 0 deletions src/implementation/bitcode/node/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Consume } from './consume';
import { Empty } from './empty';
import { Error as ErrorNode } from './error';
import { Invoke } from './invoke';
import { Int } from './int';
import { Pause } from './pause';
import { Sequence } from './sequence';
import { Single } from './single';
Expand All @@ -17,6 +18,7 @@ export default {
Consume,
Empty,
Error: class Error extends ErrorNode<frontend.node.Error> {},
Int,
Invoke,
Pause,
Sequence,
Expand Down
19 changes: 19 additions & 0 deletions src/implementation/bitcode/node/int.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import * as assert from 'assert';
import * as frontend from 'llparse-frontend';

import { Code } from '../code';
import { IRBasicBlock, IRValue } from '../compilation';
import { CONTAINER_KEY } from '../constants';
import { INodePosition, Node } from './base';

export class Int extends Node<frontend.node.Int> {
protected doBuild(bb: IRBasicBlock, pos: INodePosition): void {
const otherwise = this.ref.otherwise!;

if (!otherwise.noAdvance) {
bb = this.prologue(bb, pos);
}

this.tailTo(bb, otherwise, pos);
}
}
2 changes: 2 additions & 0 deletions src/implementation/c/node/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import * as frontend from 'llparse-frontend';
import { Consume } from './consume';
import { Empty } from './empty';
import { Error as ErrorNode } from './error';
import { Int } from './int';
import { Invoke } from './invoke';
import { Pause } from './pause';
import { Sequence } from './sequence';
Expand All @@ -17,6 +18,7 @@ export default {
Consume,
Empty,
Error: class Error extends ErrorNode<frontend.node.Error> {},
Int,
Invoke,
Pause,
Sequence,
Expand Down
10 changes: 10 additions & 0 deletions src/implementation/c/node/int.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import * as frontend from 'llparse-frontend';

import { Compilation } from '../compilation';
import { Node } from './base';

export class Int extends Node<frontend.node.Int> {
public doBuild(out: string[]): void {

}
}
2 changes: 2 additions & 0 deletions src/implementation/js/node/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import * as frontend from 'llparse-frontend';
import { Consume } from './consume';
import { Empty } from './empty';
import { Error as ErrorNode } from './error';
import { Int } from './int';
import { Invoke } from './invoke';
import { Pause } from './pause';
import { Sequence } from './sequence';
Expand All @@ -17,6 +18,7 @@ export default {
Consume,
Empty,
Error: class Error extends ErrorNode<frontend.node.Error> {},
Int,
Invoke,
Pause,
Sequence,
Expand Down
Loading