-
Notifications
You must be signed in to change notification settings - Fork 171
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add bitmaps support (OCaml backend).
- Loading branch information
Showing
8 changed files
with
140 additions
and
23 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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
(* Generated by re2ocaml *) | ||
#1 "codegen/ocaml/01_basic_b.re" | ||
(* re2ocaml $INPUT -o $OUTPUT -b *) | ||
|
||
type state = { | ||
str: string; | ||
mutable cur: int; | ||
} | ||
|
||
|
||
#12 "codegen/ocaml/01_basic_b.ml" | ||
let rec yy0 (st : state) : bool = | ||
let yych = st.str.[st.cur] in | ||
st.cur <- st.cur + 1; | ||
if (yych <= '0') then (yy1 [@tailcall]) st | ||
else if (yych <= '9') then (yy2 [@tailcall]) st | ||
else (yy1 [@tailcall]) st | ||
|
||
and yy1 (st : state) : bool = | ||
#18 "codegen/ocaml/01_basic_b.re" | ||
false | ||
#23 "codegen/ocaml/01_basic_b.ml" | ||
|
||
and yy2 (st : state) : bool = | ||
let yych = st.str.[st.cur] in | ||
if ((yybm.(0 + Char.code yych) land 128) != 0) then ( | ||
st.cur <- st.cur + 1; | ||
(yy2 [@tailcall]) st | ||
) else ( | ||
(yy3 [@tailcall]) st | ||
) | ||
|
||
and yy3 (st : state) : bool = | ||
#17 "codegen/ocaml/01_basic_b.re" | ||
true | ||
#37 "codegen/ocaml/01_basic_b.ml" | ||
|
||
and lex (st : state) : bool = | ||
(yy0 [@tailcall]) st | ||
|
||
and yybm = [| | ||
0; 0; 0; 0; 0; 0; 0; 0; | ||
0; 0; 0; 0; 0; 0; 0; 0; | ||
0; 0; 0; 0; 0; 0; 0; 0; | ||
0; 0; 0; 0; 0; 0; 0; 0; | ||
0; 0; 0; 0; 0; 0; 0; 0; | ||
0; 0; 0; 0; 0; 0; 0; 0; | ||
128; 128; 128; 128; 128; 128; 128; 128; | ||
128; 128; 0; 0; 0; 0; 0; 0; | ||
0; 0; 0; 0; 0; 0; 0; 0; | ||
0; 0; 0; 0; 0; 0; 0; 0; | ||
0; 0; 0; 0; 0; 0; 0; 0; | ||
0; 0; 0; 0; 0; 0; 0; 0; | ||
0; 0; 0; 0; 0; 0; 0; 0; | ||
0; 0; 0; 0; 0; 0; 0; 0; | ||
0; 0; 0; 0; 0; 0; 0; 0; | ||
0; 0; 0; 0; 0; 0; 0; 0; | ||
0; 0; 0; 0; 0; 0; 0; 0; | ||
0; 0; 0; 0; 0; 0; 0; 0; | ||
0; 0; 0; 0; 0; 0; 0; 0; | ||
0; 0; 0; 0; 0; 0; 0; 0; | ||
0; 0; 0; 0; 0; 0; 0; 0; | ||
0; 0; 0; 0; 0; 0; 0; 0; | ||
0; 0; 0; 0; 0; 0; 0; 0; | ||
0; 0; 0; 0; 0; 0; 0; 0; | ||
0; 0; 0; 0; 0; 0; 0; 0; | ||
0; 0; 0; 0; 0; 0; 0; 0; | ||
0; 0; 0; 0; 0; 0; 0; 0; | ||
0; 0; 0; 0; 0; 0; 0; 0; | ||
0; 0; 0; 0; 0; 0; 0; 0; | ||
0; 0; 0; 0; 0; 0; 0; 0; | ||
0; 0; 0; 0; 0; 0; 0; 0; | ||
0; 0; 0; 0; 0; 0; 0; 0; | ||
|] | ||
#19 "codegen/ocaml/01_basic_b.re" | ||
|
||
|
||
let main () = | ||
let st = {str = "1234\x00"; cur = 0} | ||
in if not (lex st) then raise (Failure "error") | ||
|
||
let _ = main () |
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,25 @@ | ||
(* re2ocaml $INPUT -o $OUTPUT -b *) | ||
|
||
type state = { | ||
str: string; | ||
mutable cur: int; | ||
} | ||
|
||
/*!re2c | ||
re2c:api = custom; | ||
re2c:define:YYFN = ["lex;bool", "st;state"]; | ||
re2c:define:YYPEEK = "st.str.[st.cur]"; | ||
re2c:define:YYSKIP = "st.cur <- st.cur + 1;"; | ||
re2c:yyfill:enable = 0; | ||
number = [1-9][0-9]*; | ||
number { true } | ||
* { false } | ||
*/ | ||
|
||
let main () = | ||
let st = {str = "1234\x00"; cur = 0} | ||
in if not (lex st) then raise (Failure "error") | ||
|
||
let _ = main () |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.